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
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>
@ -10,13 +10,12 @@ ENV LANG='en_US.UTF-8' \
ADD requirements.txt /tmp/requirements.txt
RUN apk update
RUN apk -U upgrade
RUN apk -U add python3 gcc python3-dev musl-dev libffi-dev
RUN adduser -D python
RUN pip3 install -r /tmp/requirements.txt
RUN rm -rf /tmp/src && rm -rf /var/cache/apk/* && rm -f /tmp/requirements.txt
RUN apk update && \
apk -U upgrade --ignore alpine-baselayout && \
apk -U add python3 gcc python3-dev musl-dev libffi-dev && \
adduser -D python && \
pip3 install -r /tmp/requirements.txt && \
rm -rf /tmp/src && rm -rf /var/cache/apk/* && rm -f /tmp/requirements.txt
EXPOSE 3000

47
Jenkinsfile vendored
View File

@ -1,17 +1,34 @@
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-python", 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/python"
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.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'
}
}
}
}