From 849da8c1356759908c1f5c1b405985f57e8471f9 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Apr 2020 10:36:53 -0400 Subject: [PATCH] First import --- Dockerfile | 5 +++++ Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ root/index.php | 24 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 root/index.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c814681 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +ARG VERSION="latest" +FROM "jcabillot/phpapache:${VERSION}" +LABEL maintainer="Julien Cabillot " + +COPY "root" "/var/www/html" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..25ae9e9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,38 @@ +pipeline { + environment { + registry = 'https://registry.hub.docker.com' + registryCredential = 'dockerhub_jcabillot' + dockerImage = 'jcabillot/tracks' + } + + agent any + + triggers { + cron('@midnight') + } + + stages { + stage('Clone repository') { + steps{ + checkout scm + } + } + + stage('Build image') { + steps{ + sh 'docker build --force-rm=true --no-cache=true --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}' + } + } + } + } + } +} diff --git a/root/index.php b/root/index.php new file mode 100644 index 0000000..85da7ad --- /dev/null +++ b/root/index.php @@ -0,0 +1,24 @@ +