2019-06-20 13:03:21 -04:00
|
|
|
pipeline {
|
|
|
|
|
environment {
|
|
|
|
|
registry = 'jcabillot/jenkins-wdocker'
|
|
|
|
|
registryCredential = 'dockerhub_jcabillot'
|
|
|
|
|
dockerImage = ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
agent any
|
|
|
|
|
|
|
|
|
|
stages {
|
2019-06-25 18:16:53 -04:00
|
|
|
stage('Clone repository') {
|
2019-06-25 18:19:19 -04:00
|
|
|
steps{
|
2019-06-25 18:16:53 -04:00
|
|
|
/* Let's make sure we have the repository cloned to our workspace */
|
|
|
|
|
checkout scm
|
2019-06-25 18:19:19 -04:00
|
|
|
}
|
2019-06-20 13:03:21 -04:00
|
|
|
}
|
2019-06-25 18:16:53 -04:00
|
|
|
|
|
|
|
|
stage('Build image') {
|
2019-06-25 18:19:19 -04:00
|
|
|
steps{
|
2019-06-25 18:23:22 -04:00
|
|
|
sh "docker build -t jcabillot/jenkins-wdocker ."
|
2019-06-25 18:19:19 -04:00
|
|
|
}
|
2019-06-25 18:16:53 -04:00
|
|
|
}
|
|
|
|
|
|
2019-06-20 13:03:21 -04:00
|
|
|
stage('Deploy Image') {
|
|
|
|
|
steps{
|
|
|
|
|
script {
|
2019-06-25 18:23:22 -04:00
|
|
|
withDockerRegistry(url: 'https://registry.hub.docker.com', credentialsId: 'docker-hub-credentials') {
|
|
|
|
|
sh 'docker push jcabillot/jenkins-wdocker'
|
|
|
|
|
}
|
2019-06-20 13:03:21 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|