From 42b5ffd95a8efa8ffbec4357e07ac31c95b570c2 Mon Sep 17 00:00:00 2001 From: richard Date: Sun, 5 Apr 2020 13:32:42 -0400 Subject: [PATCH] rewrite php Jenkinsfile --- dockerfiles/tasks/Jenkinsfile | 24 ++++++++++++++-- dockerfiles/tasks/php/Jenkinsfile | 46 +++++++++++++++---------------- dockerfiles/tasks/robo/Dockerfile | 9 ++++++ dockerfiles/tasks/robo/build.sh | 12 ++++++++ 4 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 dockerfiles/tasks/robo/Dockerfile create mode 100755 dockerfiles/tasks/robo/build.sh diff --git a/dockerfiles/tasks/Jenkinsfile b/dockerfiles/tasks/Jenkinsfile index 1f7c32d..8040e90 100644 --- a/dockerfiles/tasks/Jenkinsfile +++ b/dockerfiles/tasks/Jenkinsfile @@ -6,6 +6,12 @@ pipeline { choices: ['ansible', 'apidocjs', 'composer', 'mondrian', 'php'], description: 'What image would you like to build?' ) + string( + name: 'VERSION', + default: 'latest', + description: 'what tag to apply to the image' + + ) } options { buildDiscarder(logRotator(numToKeepStr: '10')) @@ -17,10 +23,22 @@ pipeline { checkout scm sh 'ls' - dir("dockerfiles/tasks/$params.IMAGE") { - sh 'chmod +x build.sh && ls -l' +// dir("dockerfiles/tasks/$params.IMAGE") { +// sh 'chmod +x build.sh && ls -l' +// +// sh './build.sh' +// } - sh './build.sh' + def workdir = "dockerfiles/tasks/$params.IMAGE" + def dockerfile = 'Dockerfile' + + dir(workdir) { + docker.withRegistry('http://dkregistry.xai-corp.net:5000') { + def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/${params.IMAGE}:${params.VERSION}", "-f ${dockerfile} .") + customImage.inside() { + } + customImage.push() + } } } } diff --git a/dockerfiles/tasks/php/Jenkinsfile b/dockerfiles/tasks/php/Jenkinsfile index 42a3d83..679659c 100644 --- a/dockerfiles/tasks/php/Jenkinsfile +++ b/dockerfiles/tasks/php/Jenkinsfile @@ -21,34 +21,32 @@ pipeline { // } stage('Build PHP Images') { - steps { - def workdir = "dockerfiles/tasks/php" - parallel php70 { - def version = "7.0" - def dockerfile = "Dockerfile-70" - dir(workdir) { - docker.withRegistry('http://dkregistry.xai-corp.net:5000') { - def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/php:${version}", "-f ${dockerfile} .") - customImage.inside() { - sh "php --version | grep 'PHP 7.1'" - } - customImage.push() + def workdir = "dockerfiles/tasks/php" + parallel php70 { + def version = "7.0" + def dockerfile = "Dockerfile-70" + dir(workdir) { + docker.withRegistry('http://dkregistry.xai-corp.net:5000') { + def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/php:${version}", "-f ${dockerfile} .") + customImage.inside() { + sh "php --version | grep 'PHP 7.1'" } + customImage.push() } - }, php71 { - def version = "7.1" - def dockerfile = "Dockerfile-71" - dir(workdir) { - docker.withRegistry('http://dkregistry.xai-corp.net:5000') { - def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/php:${version}", "-f ${dockerfile} .") - customImage.inside() { - sh "php --version | grep 'PHP 7.1'" - } - customImage.push() + } + }, php71 { + def version = "7.1" + def dockerfile = "Dockerfile-71" + dir(workdir) { + docker.withRegistry('http://dkregistry.xai-corp.net:5000') { + def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/php:${version}", "-f ${dockerfile} .") + customImage.inside() { + sh "php --version | grep 'PHP 7.1'" } + customImage.push() } - }, failFast: false - } + } + }, failFast: false } } } diff --git a/dockerfiles/tasks/robo/Dockerfile b/dockerfiles/tasks/robo/Dockerfile new file mode 100644 index 0000000..609f9bd --- /dev/null +++ b/dockerfiles/tasks/robo/Dockerfile @@ -0,0 +1,9 @@ +# php Robo task runner container +# +FROM dkregistry.xai-corp.net:5000/xaicorp/php:7.2-dev +MAINTAINER Richard Morgan + +RUN wget http://robo.li/robo.phar \ + && chmod +x robo.phar && sudo mv robo.phar /usr/bin/robo + +ENTRYPOINT ['/usr/bin/robo'] diff --git a/dockerfiles/tasks/robo/build.sh b/dockerfiles/tasks/robo/build.sh new file mode 100755 index 0000000..dd23804 --- /dev/null +++ b/dockerfiles/tasks/robo/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e + +#if [[ -z "${DKREGISTRY_PASS}" ]]; then +# docker login -u richard -p $DKREGISTRY_PASS $DKREGISTRY +#fi + +docker build --rm -f Dockerfile -t xaicorp/php-robo . +docker run --rm xaicorp/php-robo --version | grep 'ansible 2.0.' +docker tag xaicorp/php-robo dkregistry.xai-corp.net:5000/xaicorp/php-robo +#docker push dkregistry.xai-corp.net:5000/xaicorp/php-robo +