htpasswd/Jenkinsfile

39 lines
830 B
Plaintext
Raw Permalink Normal View History

2019-06-20 12:49:32 -04:00
pipeline {
environment {
2019-07-13 17:42:53 -04:00
registry = 'https://registry.hub.docker.com'
2019-06-20 12:49:32 -04:00
registryCredential = 'dockerhub_jcabillot'
2019-07-13 17:42:53 -04:00
dockerImage = 'jcabillot/htpasswd'
2019-06-20 12:49:32 -04:00
}
agent any
2019-07-13 17:42:53 -04:00
triggers {
cron('@midnight')
}
2019-06-20 12:49:32 -04:00
stages {
2019-07-13 17:42:53 -04:00
stage('Clone repository') {
2019-06-20 12:49:32 -04:00
steps{
2019-07-13 17:42:53 -04:00
checkout scm
2019-06-20 12:49:32 -04:00
}
}
2019-07-13 17:42:53 -04:00
stage('Build image') {
steps{
2020-01-08 13:57:35 -05:00
sh 'docker build --force-rm=true --no-cache=true --pull -t ${dockerImage} .'
2019-07-13 17:42:53 -04:00
}
}
2019-06-20 12:52:52 -04:00
stage('Deploy Image') {
steps{
script {
2019-07-13 17:42:53 -04:00
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
sh 'docker push ${dockerImage}'
2019-06-20 12:52:52 -04:00
}
}
}
}
2019-06-20 12:49:32 -04:00
}
}