Switched to node builder and updated to Alpine 3.12

This commit is contained in:
Jonathan Ervine 2020-07-21 19:40:12 +08:00
parent 980c01bc9b
commit 13a925fcfb
2 changed files with 39 additions and 23 deletions

View File

@ -1,5 +1,5 @@
# Base on latest (edge) alpine image # Base on latest (edge) alpine image
FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11 FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.12
MAINTAINER “Jonathan Ervine” <docker@ervine.org> MAINTAINER “Jonathan Ervine” <docker@ervine.org>
@ -10,13 +10,12 @@ ENV LANG='en_US.UTF-8' \
ADD requirements.txt /tmp/requirements.txt ADD requirements.txt /tmp/requirements.txt
RUN apk update RUN apk update && \
RUN apk -U upgrade apk -U upgrade --ignore alpine-baselayout && \
RUN apk -U add python3 gcc python3-dev musl-dev libffi-dev apk -U add python3 gcc python3-dev musl-dev libffi-dev && \
RUN adduser -D python adduser -D python && \
RUN pip3 install -r /tmp/requirements.txt pip3 install -r /tmp/requirements.txt && \
rm -rf /tmp/src && rm -rf /var/cache/apk/* && rm -f /tmp/requirements.txt
RUN rm -rf /tmp/src && rm -rf /var/cache/apk/* && rm -f /tmp/requirements.txt
EXPOSE 3000 EXPOSE 3000

47
Jenkinsfile vendored
View File

@ -1,17 +1,34 @@
node("docker-node") { podTemplate(yaml: """
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { kind: Pod
spec:
git branch: "3.11.6", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-python", credentialsId: 'jenkins-to-git' containers:
- name: kaniko
sh "git rev-parse HEAD > .git/commit-id" image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251
def commit_id = readFile('.git/commit-id').trim() imagePullPolicy: Always
println commit_id command:
- /busybox/cat
stage "build" tty: true
def app = docker.build "library/x86_64/alpine/python" volumeMounts:
- name: jenkins-docker-cfg
stage "publish" mountPath: /kaniko/.docker
app.push("${env.BUILD_NUMBER}") volumes:
app.push("latest") - 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.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/python:3.12.0 --destination=harbor.ervine.dev/library/x86_64/alpine/python:3.12'
}
} }
}
} }