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 -Ls 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: "" ) ], ) ], volumes: [ configMapVolume( mountPath: "/etc/docker/", configMapName: "dind-insecure-registries" ) ] ) { 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 """ } } } }