Update Jenkinsfile

This commit is contained in:
Oleksandr Butenko 2021-06-13 13:49:47 +03:00 committed by GitHub
parent b01467cb77
commit 1e7b5c7810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

45
Jenkinsfile vendored
View file

@ -5,33 +5,34 @@ pipeline {
steps { steps {
echo 'Running build automation' echo 'Running build automation'
sh './mvnw package' sh './mvnw package'
archiveArtifacts artifacts: '/trainSchedule.zip'
} }
} }
stage('Build Docker Image') { stage('Build Docker Image') {
when { when {
branch 'master' branch 'master'
} }
steps { steps {
script { script {
app = docker.build("sprientera/pets") app = docker.build("sprientera/pet")
app.inside { app.inside {
sh 'echo $(curl localhost:80)' sh 'echo $(curl localhost:8080)'
} }
} }
} }
}
stage('Push Docker Image') {
when {
branch 'master'
} }
steps { stage('Push Docker Image') {
script { when {
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') { branch 'master'
app.push("${env.BUILD_NUMBER}") }
app.push("latest") steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'docker_hub_login') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
} }
} }
} }
} }
} }
}