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
FROM opensuse/leap:15.1
FROM opensuse/leap:15.2
MAINTAINER “Jonathan Ervine” <docker@ervine.org>
@ -12,17 +12,17 @@ ENV LANG='en_US.UTF-8' \
PM_UID='1003' \
PM_GID='1003'
RUN zypper -n in tar wget gzip
RUN groupadd -g $PM_GID $PM_GROUP
RUN useradd -u $PM_UID -g $PM_GROUP -M $PM_USER
RUN mkdir /pmmp
RUN 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
RUN cd /pmmp && tar zxvf PHP-7.3-Linux-x86_64.tar.gz
RUN zypper -n in tar wget gzip && \
groupadd -g $PM_GID $PM_GROUP && \
useradd -u $PM_UID -g $PM_GROUP -M $PM_USER && \
mkdir /pmmp && \
chown $PM_USER:$PM_GROUP /pmmp && \
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 && \
cd /pmmp && tar zxvf PHP-7.3-Linux-x86_64.tar.gz
ADD php.ini /pmmp/bin/php7/bin/php.ini
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
RUN chown -R $PM_USER:$PM_GROUP /pmmp
RUN rm /pmmp/PHP-7.3-Linux-x86_64.tar.gz && \
wget -q -O - https://github.com/pmmp/PocketMine-MP/releases/download/3.13.0/PocketMine-MP.phar > /pmmp/PocketMine-MP.phar && \
chown -R $PM_USER:$PM_GROUP /pmmp
VOLUME /plugins
VOLUME /config

54
Jenkinsfile vendored
View File

@ -1,23 +1,35 @@
node("docker-node") {
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
git branch: "3.11.3", url: "ssh://git@git.ervine.org/jonny/x86_64-suse-pocketmine", credentialsId: 'jenkins-to-git'
sh "git rev-parse HEAD > .git/commit-id"
def commit_id = readFile('.git/commit-id').trim()
println commit_id
try {
stage "build"
def app = docker.build "library/x86_64/suse/pocketmine"
stage "publish"
app.push("${env.BUILD_NUMBER}")
app.push("latest")
app.push("3.12.0")
}
catch (err) {
currentBuild.result = 'FAILURE'
}
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-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'
}
}
}
}