Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-21 22:19:05 +08:00
parent b3e31e335f
commit b566d625c6
2 changed files with 44 additions and 32 deletions

View File

@ -1,5 +1,5 @@
# Base on latest (edge) alpine image # Base on latest (edge) alpine image
FROM opensuse/leap:15.1 FROM opensuse/leap:15.2
MAINTAINER “Jonathan Ervine” <docker@ervine.org> MAINTAINER “Jonathan Ervine” <docker@ervine.org>
@ -12,17 +12,17 @@ ENV LANG='en_US.UTF-8' \
PM_UID='1003' \ PM_UID='1003' \
PM_GID='1003' PM_GID='1003'
RUN zypper -n in tar wget gzip RUN zypper -n in tar wget gzip && \
RUN groupadd -g $PM_GID $PM_GROUP groupadd -g $PM_GID $PM_GROUP && \
RUN useradd -u $PM_UID -g $PM_GROUP -M $PM_USER useradd -u $PM_UID -g $PM_GROUP -M $PM_USER && \
RUN mkdir /pmmp mkdir /pmmp && \
RUN chown $PM_USER:$PM_GROUP /pmmp chown $PM_USER:$PM_GROUP /pmmp && \
RUN wget -q -O - https://jenkins.pmmp.io/job/PHP-7.3-Aggregate/lastSuccessfulBuild/artifact/PHP-7.3-Linux-x86_64.tar.gz > /pmmp/PHP-7.3-Linux-x86_64.tar.gz wget -q -O - https://jenkins.pmmp.io/job/PHP-7.3-Aggregate/lastSuccessfulBuild/artifact/PHP-7.3-Linux-x86_64.tar.gz > /pmmp/PHP-7.3-Linux-x86_64.tar.gz && \
RUN cd /pmmp && tar zxvf PHP-7.3-Linux-x86_64.tar.gz cd /pmmp && tar zxvf PHP-7.3-Linux-x86_64.tar.gz
ADD php.ini /pmmp/bin/php7/bin/php.ini ADD php.ini /pmmp/bin/php7/bin/php.ini
RUN rm /pmmp/PHP-7.3-Linux-x86_64.tar.gz RUN rm /pmmp/PHP-7.3-Linux-x86_64.tar.gz && \
RUN wget -q -O - https://github.com/pmmp/PocketMine-MP/releases/download/3.13.0/PocketMine-MP.phar > /pmmp/PocketMine-MP.phar wget -q -O - https://github.com/pmmp/PocketMine-MP/releases/download/3.13.0/PocketMine-MP.phar > /pmmp/PocketMine-MP.phar && \
RUN chown -R $PM_USER:$PM_GROUP /pmmp chown -R $PM_USER:$PM_GROUP /pmmp
VOLUME /plugins VOLUME /plugins
VOLUME /config VOLUME /config

54
Jenkinsfile vendored
View File

@ -1,23 +1,35 @@
node("docker-node") { podTemplate(yaml: """
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { kind: Pod
spec:
git branch: "3.11.3", url: "ssh://git@git.ervine.org/jonny/x86_64-suse-pocketmine", 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
try { tty: true
stage "build" volumeMounts:
def app = docker.build "library/x86_64/suse/pocketmine" - name: jenkins-docker-cfg
mountPath: /kaniko/.docker
stage "publish" volumes:
app.push("${env.BUILD_NUMBER}") - name: jenkins-docker-cfg
app.push("latest") projected:
app.push("3.12.0") sources:
} - secret:
catch (err) { name: regcred
currentBuild.result = 'FAILURE' items:
} - key: .dockerconfigjson
path: config.json
"""
) {
node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'ssh://git@git.ervine.org/jonny/x86_64-suse-pocketmine.git', credentialsId: 'jenkins-to-git'
container('kaniko') {
sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/suse/pocketmine:3.13'
}
} }
}
} }