use new jenkinsfile
Some checks failed
perso/htpasswd/master There was a failure building this commit

This commit is contained in:
Julien Cabillot 2019-07-13 17:42:53 -04:00
parent 5db3426f3e
commit 6157fd6422

26
Jenkinsfile vendored
View File

@ -1,25 +1,35 @@
pipeline {
environment {
registry = 'jcabillot/htpasswd'
registry = 'https://registry.hub.docker.com'
registryCredential = 'dockerhub_jcabillot'
dockerImage = ''
dockerImage = 'jcabillot/htpasswd'
}
agent any
triggers {
cron('@midnight')
}
stages {
stage('Building image') {
stage('Clone repository') {
steps{
script {
dockerImage = docker.build registry + ":latest"
}
checkout scm
}
}
stage('Build image') {
steps{
sh "docker build -t jcabillot/jenkins-wdocker ."
}
}
stage('Deploy Image') {
steps{
script {
docker.withRegistry('', registryCredential) {
dockerImage.push()
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
sh 'docker push ${dockerImage}'
}
}
}