use new jenkinsfile
Some checks failed
perso/htpasswd/master There was a failure building this commit
Some checks failed
perso/htpasswd/master There was a failure building this commit
This commit is contained in:
parent
5db3426f3e
commit
6157fd6422
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@ -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}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user