mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-29 18:55:49 +00:00
JenkinsFile docker configuration
This commit is contained in:
parent
c7023de05c
commit
845197d0a6
1 changed files with 24 additions and 18 deletions
42
Jenkinsfile
vendored
42
Jenkinsfile
vendored
|
@ -1,9 +1,7 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
registry = "rolandgryddynamics/mr"
|
DOCKERHUB_CREDENTIALS=credentials('rolandgryddynamics-dockerhub')
|
||||||
registryCredential = 'dockerhub_id'
|
|
||||||
dockerImage = ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
agent {
|
agent {
|
||||||
|
@ -29,21 +27,29 @@ pipeline {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
stage('Building docker image') {
|
stage('docker') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
// sh 'docker version'
|
||||||
dockerImage = docker.build registry + ":$BUILD_NUMBER"
|
// app = docker.build("rolandgryddynamics/mr")
|
||||||
}
|
sh 'docker build -t rolandgryddynamics/mr:latest .'
|
||||||
}
|
|
||||||
}
|
// sh 'docker tag my/app rolandgryddynamics/mr'
|
||||||
stage('Deploy our image') {
|
// sh 'docker tag push rolandgryddynamics/mr'
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
docker.withRegistry( '', registryCredential ) {
|
|
||||||
dockerImage.push()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('login') {
|
||||||
|
steps {
|
||||||
|
sh 'echo DOCKERHUB_CREDENTIALS_PSW | docker login $DOCKERHUB_CREDENTIALS_USR --password-stdin'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('deploy to dockerhub') {
|
||||||
|
steps {
|
||||||
|
sh 'docker tag push rolandgryddynamics/mr:latest'
|
||||||
|
// script {
|
||||||
|
// docker.withRegistry('https://registry.hub.docker.com', 'webserver_login' )
|
||||||
|
// app.push("latest")
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue