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
34
Jenkinsfile
vendored
34
Jenkinsfile
vendored
|
@ -1,9 +1,7 @@
|
|||
pipeline {
|
||||
|
||||
environment {
|
||||
registry = "rolandgryddynamics/mr"
|
||||
registryCredential = 'dockerhub_id'
|
||||
dockerImage = ''
|
||||
DOCKERHUB_CREDENTIALS=credentials('rolandgryddynamics-dockerhub')
|
||||
}
|
||||
|
||||
agent {
|
||||
|
@ -29,20 +27,28 @@ pipeline {
|
|||
// }
|
||||
// }
|
||||
|
||||
stage('Building docker image') {
|
||||
stage('docker') {
|
||||
steps {
|
||||
script {
|
||||
dockerImage = docker.build registry + ":$BUILD_NUMBER"
|
||||
}
|
||||
// sh 'docker version'
|
||||
// app = docker.build("rolandgryddynamics/mr")
|
||||
sh 'docker build -t rolandgryddynamics/mr:latest .'
|
||||
|
||||
// sh 'docker tag my/app rolandgryddynamics/mr'
|
||||
// sh 'docker tag push rolandgryddynamics/mr'
|
||||
}
|
||||
}
|
||||
stage('Deploy our image') {
|
||||
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