added jenkinsfile for CI

This commit is contained in:
Taylor Christie
2019-04-09 10:57:53 -06:00
parent 2ff0b7fa9f
commit d2acdf4a91
2 changed files with 75 additions and 0 deletions

47
Jenkinsfile vendored Normal file
View 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"
}
}
}
}