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
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@ -1,25 +1,35 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
environment {
|
environment {
|
||||||
registry = 'jcabillot/htpasswd'
|
registry = 'https://registry.hub.docker.com'
|
||||||
registryCredential = 'dockerhub_jcabillot'
|
registryCredential = 'dockerhub_jcabillot'
|
||||||
dockerImage = ''
|
dockerImage = 'jcabillot/htpasswd'
|
||||||
}
|
}
|
||||||
|
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
cron('@midnight')
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Building image') {
|
stage('Clone repository') {
|
||||||
steps{
|
steps{
|
||||||
script {
|
checkout scm
|
||||||
dockerImage = docker.build registry + ":latest"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Build image') {
|
||||||
|
steps{
|
||||||
|
sh "docker build -t jcabillot/jenkins-wdocker ."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Deploy Image') {
|
stage('Deploy Image') {
|
||||||
steps{
|
steps{
|
||||||
script {
|
script {
|
||||||
docker.withRegistry('', registryCredential) {
|
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
||||||
dockerImage.push()
|
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
|
||||||
|
sh 'docker push ${dockerImage}'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user