Update Jenkinsfile

This commit is contained in:
senatorovv 2023-07-12 12:08:25 +04:00 committed by GitHub
parent f111398d8a
commit 783341f10a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

23
Jenkinsfile vendored
View file

@ -1,12 +1,27 @@
#!groovy
pipeline {
agent none
stages {
agent none stages {
stage('Maven Install') {
agent any
steps {
agent any
steps {
sh 'mvn clean install'
}
}
stage('Docker Build') {
agent any
steps {
sh 'docker build -t shanem/spring-petclinic:latest .'
}
}
stage('Docker Push') {
agent any
steps {
withCredentials([usernamePassword(credentialsId: 'dockerHub', passwordVariable: 'dockerHubPassword', usernameVariable: 'dockerHubUser')]) {
sh "docker login -u ${env.dockerHubUser} -p ${env.dockerHubPassword}"
sh 'docker push shanem/spring-petclinic:latest'
}
}
}
}
}