From cf14ae497bbcc642306cfc8be31740438c93e092 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Mon, 20 Jul 2020 15:09:58 +0800 Subject: [PATCH] Switched to 3.12 and node builder --- Dockerfile | 4 ++-- Jenkinsfile | 48 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf4241c..bf8b799 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base on latest (edge) alpine image -FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.10 +FROM harbor.ervine.dev/library/x86_64/alpine/alpine:3.12 MAINTAINER “Jonathan Ervine” @@ -7,7 +7,7 @@ MAINTAINER “Jonathan Ervine” ENV LANG='en_US.UTF-8' \ LANGUAGE='en_US.UTF-8' -RUN apk update && apk -U upgrade && apk add python3 git +RUN apk update && apk -U upgrade --ignore alpine-baselayout && apk add python3 git openssh-client gcc python3-dev musl-dev libffi-dev openssl-dev VOLUME /data diff --git a/Jenkinsfile b/Jenkinsfile index d26438f..6931477 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,18 +1,34 @@ -node("docker-node") { - docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { - - git branch: "3.10.3", url: "ssh://git@git.ervine.org:2222/jonny/alpine-kubespray-installer", 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/kubespray" - - stage "publish" - app.push("${env.BUILD_NUMBER}") - app.push("latest") - app.push("3.10") +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 'https://git.ervine.org/jonny/kubespray-installer' + container('kaniko') { + sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/alpine/htpc-mgr:latest --destination=harbor.ervine.dev/library/x86_64/alpine/htpc-mgr:3.12' + } } + } }