commit 525109e15d706811499beffc96658cef814cf458 Author: TheSp1der Date: Thu Oct 24 14:15:51 2019 -0500 initial commit diff --git a/build-minecraft.jenkins b/build-minecraft.jenkins new file mode 100644 index 0000000..a3091c6 --- /dev/null +++ b/build-minecraft.jenkins @@ -0,0 +1,74 @@ +def dockerFile = """ +FROM alpine:latest + +MAINTAINER The_Spider + +RUN \ + apk add --no-cache openjdk11 curl && \ + addgroup -S -g 1000 minecraft && \ + adduser -S minecraft -G minecraft -h /minecraft -u 1000 + +USER minecraft + +WORKDIR /minecraft + +RUN \ + curl -L https://papermc.io/api/v1/paper/1.14.4/latest/download -o /minecraft/paper-mc.jar && \ + mkdir /minecraft/data && \ + mkdir /minecraft/html && \ + cd /minecraft/data && \ + java -jar ../paper-mc.jar; exit 0 + +CMD cd data; java -Xms1g -Xmx20g -jar ../paper-mc.jar +""" + +podTemplate( + containers: [ + containerTemplate( + name: "docker", + image: "docker:19.03", + command: "sleep", + args: "99d", + envVars: [ + envVar( + key: "DOCKER_HOST", + value: "tcp://localhost:2375" + ) + ] + ), + containerTemplate( + name: "docker-daemon", + image: "docker:19.03-dind", + privileged: true, + envVars: [ + envVar( + key: "DOCKER_TLS_CERTDIR", + value: "" + ) + ] + ) + ] +) { + node(POD_LABEL) { + container("docker") { + stage("Test DinD Daemon") { + sh """ + docker version + """ + } + stage("Write Dockerfile"){ + writeFile(file: "Dockerfile", text: dockerFile) + } + stage("Build Container"){ + sh """ + docker build --tag registry.test-chamber-13.lan:5000/minecraft:latest ./ + """ + } + stage("Push Container"){ + sh """ + docker push registry.test-chamber-13.lan:5000/minecraft:latest + """ + } + } + } +} \ No newline at end of file