From 24144e3f30c948ffb5513f074f936379e2b0d195 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Mon, 20 Jul 2020 23:23:18 +0800 Subject: [PATCH] Switched to node builer and version 1.19.1 --- Dockerfile | 4 ++-- Jenkinsfile | 48 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd332f8..61d33df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11 +FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.12 LABEL maintainer="Jonathan Ervine " "Alpine Linux version"="3.11.3" "NGINX version"="1.17.8" date="19022020" -ENV NGINX_VERSION 1.18.0 +ENV NGINX_VERSION 1.19.1 RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \ && CONFIG="\ diff --git a/Jenkinsfile b/Jenkinsfile index 9b06406..76b8611 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,35 @@ -node("docker-node") { - docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { - - git branch: "3.11.6", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-nginx", credentialsId: 'jenkins-to-git' - - sh "git rev-parse HEAD > .git/commit-id" - def commit_id = readFile('.git/commit-id').trim() - println commit_id - - stage "build" - def app = docker.build "library/x86_64/alpine/nginx-source" - - stage "publish" - app.push("${env.BUILD_NUMBER}") - app.push("latest") +podTemplate(yaml: """ +kind: Pod +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251 + imagePullPolicy: Always + command: + - /busybox/cat + tty: true + volumeMounts: + - name: jenkins-docker-cfg + mountPath: /kaniko/.docker + volumes: + - name: jenkins-docker-cfg + projected: + sources: + - secret: + name: regcred + items: + - key: .dockerconfigjson + path: config.json +""" + ) { + + node(POD_LABEL) { + stage('Build with Kaniko') { + git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-nginx.git', credentialsId: 'jenkins-to-git' + container('kaniko') { + sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/alpine/nginx:1.19.1' + } } + } } +