added jenkinsfile for CI
This commit is contained in:
47
Jenkinsfile
vendored
Normal file
47
Jenkinsfile
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
def label = "node-${UUID.randomUUID().toString()}"
|
||||
|
||||
podTemplate(label: label, inheritFrom: 'base', , containers: [
|
||||
containerTemplate(name: 'base', image: 'taylorchristieyardstick/build-base:node')
|
||||
]) {
|
||||
node(label) {
|
||||
stage('Checkout Project') {
|
||||
container('base') {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Install Dependencies') {
|
||||
container('base') {
|
||||
sh "npm ci"
|
||||
sh "npm install -g typescript"
|
||||
}
|
||||
}
|
||||
stage('Run unit tests') {
|
||||
container('base') {
|
||||
sh "npm test"
|
||||
}
|
||||
}
|
||||
stage('Build the Project') {
|
||||
container('base') {
|
||||
sh "tsc"
|
||||
}
|
||||
}
|
||||
stage('Login to Dockerhub') {
|
||||
withCredentials([usernamePassword(credentialsId: 'DockerHubAccessYardstick', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
|
||||
container('base') {
|
||||
sh "docker login --username ${USER} --password ${PASS}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build the Docker Image') {
|
||||
container('base') {
|
||||
sh "make build"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push the Docker Image') {
|
||||
container('base') {
|
||||
sh "make push"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user