This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
build-containers/build-minecraft.jenkins
2019-10-24 14:58:53 -05:00

80 lines
1.5 KiB
Plaintext

def dockerFile = """
FROM alpine:latest
MAINTAINER The_Spider <spider@smoothnet.org>
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_TLS_VERIFY=0 docker push registry.test-chamber-13.lan:5000/minecraft:latest
"""
}
}
}
}