jenkins-wdocker/Jenkinsfile

35 lines
776 B
Plaintext
Raw Normal View History

2019-06-20 13:03:21 -04:00
pipeline {
environment {
2019-06-25 18:29:34 -04:00
registry = 'https://registry.hub.docker.com'
2019-06-20 13:03:21 -04:00
registryCredential = 'dockerhub_jcabillot'
2019-06-25 18:29:34 -04:00
dockerImage = 'jcabillot/jenkins-wdocker'
2019-06-20 13:03:21 -04:00
}
2019-06-25 18:31:11 -04:00
agent any
2019-06-20 13:03:21 -04:00
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
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:32:30 -04:00
withDockerRegistry(url: 'https://docker.io', credentialsId: 'dockerhub_jcabillot') {
2019-06-26 17:52:23 -04:00
sh 'cat /var/jenkins_home/workspace/perso_jenkins-wdocker_master@tmp/abed23b6-7300-4b49-82d2-0f788b5079a0/config.json'
2019-06-25 18:23:22 -04:00
sh 'docker push jcabillot/jenkins-wdocker'
}
2019-06-20 13:03:21 -04:00
}
}
}
}
}