From dfe767d8286cc14f99125e69117dc701a50e774b Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Wed, 8 Jan 2020 10:02:49 -0500 Subject: [PATCH] Change from to dockerhub --- Dockerfile | 2 +- Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile index 2e47044..33cc293 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG VERSION="latest" -FROM "registry.cabillot.eu/www/phpapache:${VERSION}" +FROM "jcabillot/phpapache:${VERSION}" LABEL maintainer="Julien Cabillot " RUN curl -s -S -L "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz" | tar -zx --strip=1 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..aa8a2df --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,38 @@ +pipeline { + environment { + registry = 'https://registry.hub.docker.com' + registryCredential = 'dockerhub_jcabillot' + dockerImage = 'jcabillot/dokuwiki' + } + + agent any + + triggers { + cron('@midnight') + } + + stages { + stage('Clone repository') { + steps{ + checkout scm + } + } + + stage('Build image') { + steps{ + sh 'docker build --force-rm --no-cache --pull -t ${dockerImage} .' + } + } + + stage('Deploy Image') { + steps{ + script { + withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) { + sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}' + sh 'docker push ${dockerImage}' + } + } + } + } + } +}