mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 16:45:48 +00:00
Update Jenkinsfile
This commit is contained in:
parent
bdbfc4480c
commit
0187e33136
1 changed files with 9 additions and 3 deletions
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
|
@ -1,3 +1,10 @@
|
||||||
|
environment {
|
||||||
|
IMAGE_BASE = 'rodley/spring-petclinic'
|
||||||
|
IMAGE_TAG = "v$BUILD_NUMBER"
|
||||||
|
IMAGE_NAME = "${env.IMAGE_BASE}:${env.IMAGE_TAG}"
|
||||||
|
IMAGE_NAME_LATEST = "${env.IMAGE_BASE}:latest"
|
||||||
|
DOCKERFILE_NAME = "Dockerfile"
|
||||||
|
}
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
@ -20,15 +27,14 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
echo 'Creating Docker Image...'
|
echo 'Creating Docker Image...'
|
||||||
sh '''
|
sh '''
|
||||||
docker build . -t rodley/pet-clinic:${BUILD_NUMBER} -f Dockerfile
|
docker build . -t ${env.IMAGE_NAME} -f ${env.DOCKERFILE_NAME}
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push artifact to docker registry') {
|
stage('Push artifact to docker registry') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def dockerImage = docker.build("${env.IMAGE_NAME}", "-f ${env.DOCKERFILE_NAME} .")
|
docker.withRegistry('', 'dockerhub_id') {
|
||||||
docker.withRegistry('', 'dockerhub-creds') {
|
|
||||||
dockerImage.push()
|
dockerImage.push()
|
||||||
dockerImage.push("latest")
|
dockerImage.push("latest")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue