Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-20 22:34:32 +08:00
parent 6bf734f05e
commit d679b0176b
3 changed files with 31 additions and 26 deletions

View File

@ -8,10 +8,6 @@ ENV LANG='en_US.UTF-8' \
LANGUAGE='en_US.UTF-8' \
TERM='xterm' \
VERSION='develop' \
APP_USER='mediaservice' \
APP_GROUP='mediaservice' \
APP_UID='1003' \
APP_GID='1003'
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk -U update && \
@ -21,6 +17,5 @@ RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositorie
rm -rf /var/cache/apk/*
COPY start.sh /usr/local/bin/start.sh
RUN chmod 755 /usr/local/bin/start.sh
CMD [ "/usr/local/bin/start.sh" ]

52
Jenkinsfile vendored
View File

@ -1,24 +1,34 @@
node("docker-node") {
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
git branch: "master", url: "ssh://git@git.ervine.org/jonny/x86_64-alpine-db-sidecar", credentialsId: 'jenkins-to-git'
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
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
"""
) {
try {
stage "build"
def app = docker.build "library/x86_64/alpine/db-sidecar"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("3.12")
app.push("latest")
}
catch (err) {
currentBuild.result = 'FAILURE'
}
node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-sidecar.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/db-sidecar:3.12'
}
}
}
}

0
start.sh Normal file → Executable file
View File