mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Edit Jenkinsfile
This commit is contained in:
parent
f1e1a687b3
commit
15f8ce5a6a
1 changed files with 14 additions and 0 deletions
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
|
@ -35,5 +35,19 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage ('Create Docker Image for Main Branch') {
|
||||||
|
when {
|
||||||
|
branch 'main'
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'docker build -t vkarpenko02/main:${GIT_COMMIT} .'
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'docker_key', usernameVariable: 'DOCKER_HUB_USER', passwordVariable: 'DOCKER_HUB_PASS')]) {
|
||||||
|
sh """
|
||||||
|
echo ${DOCKER_HUB_PASS} | docker login -u ${DOCKER_HUB_USER} --password-stdin
|
||||||
|
docker push vkarpenko02/main:${GIT_COMMIT}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue