Switched to node builder

This commit is contained in:
Jonathan Ervine 2020-07-20 23:52:28 +08:00
parent caee10c44f
commit 25f8884f1e
3 changed files with 35 additions and 25 deletions

View File

@ -15,7 +15,7 @@ ENV LANG='en_US.UTF-8' \
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk -U update && \
apk -U upgrade && \
apk -U upgrade --ignore alpine-baselayout && \
apk -U add \
libmediainfo \
ca-certificates \
@ -26,7 +26,6 @@ RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositorie
rm -rf /var/cache/apk/*
ADD start.sh /usr/local/bin/start.sh
RUN chmod 755 /usr/local/bin/start.sh
RUN wget https://update.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz -O nzbdrone.tar.gz && \
tar zxvf nzbdrone.tar.gz && \

55
Jenkinsfile vendored
View File

@ -1,26 +1,35 @@
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-sonarr", 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/sonarr"
stage "publish"
app.push("v2.0.0.5344")
app.push("v2")
stage('Deploy on K8s'){
sh "/usr/local/bin/kubectl -n media delete po sonarr-0"
}
}
catch (err) {
currentBuild.result = 'FAILURE'
}
node(POD_LABEL) {
stage('Build with Kaniko') {
git url: 'ssh://git@git.ervine.org/jonny/x86_64-alpine-sonarr.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/sonarr:2.0.0.5344 --destination=harbor.ervine.dev/library/x86_64/alpine/sonarr:2'
}
}
}
}

2
start.sh Normal file → Executable file
View File

@ -2,5 +2,7 @@
##
## Script to start the sonarr server
##
addgroup -g $GID $USER
adduser -D -u $UID -G $USER -H $USER
until [ -f "/config/nzbdrone.db" ]; do sleep 1; done
/usr/bin/mono --debug /NzbDrone/NzbDrone.exe --nobrowser --data=/config