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

76 lines
1.5 KiB
Plaintext

def dockerFile = """
FROM alpine:latest
MAINTAINER The_Spider <spider@smoothnet.org>
RUN \\
apk add --no-cache openjdk8 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.15.1/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",
command: "dockerd-entrypoint.sh",
args: "--insecure-registry registry.test-chamber-13.lan:5000",
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
"""
}
}
}
}