Update 'build-minecraft.jenkins'
This commit is contained in:
parent
0f6e59479b
commit
14e4df179a
@ -64,15 +64,14 @@ spec:
|
|||||||
def dockerFile = """
|
def dockerFile = """
|
||||||
FROM ${baseImage}:${baseImageTag}
|
FROM ${baseImage}:${baseImageTag}
|
||||||
|
|
||||||
|
ARG paperDownload
|
||||||
|
|
||||||
MAINTAINER The_Spider <spider@smoothnet.org>
|
MAINTAINER The_Spider <spider@smoothnet.org>
|
||||||
|
|
||||||
RUN sed -i -r -e 's/v3.14\\/community/edge\\/community/' /etc/apk/repositories && \\
|
RUN sed -i -r -e 's/v3.14\\/community/edge\\/community/' /etc/apk/repositories && \\
|
||||||
apk add --no-cache ${alpineJavaPackage} curl jq && \\
|
apk add --no-cache ${alpineJavaPackage} curl jq && \\
|
||||||
addgroup -S -g 1000 minecraft && \\
|
addgroup -S -g 1000 minecraft && \\
|
||||||
adduser -S minecraft -G minecraft -h /minecraft -u 1000 && \\
|
adduser -S minecraft -G minecraft -h /minecraft -u 1000 && \\
|
||||||
paperBuild=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion} | jq '.builds | max') && \\
|
|
||||||
paperFile=\$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild} | jq '.downloads.application.name') && \\
|
|
||||||
paperDownload="https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/\${paperBuild}/downloads/\${paperFile}" && \\
|
|
||||||
curl --location --fail --silent \${paperDownload} -o /minecraft/paper-mc.jar && \\
|
curl --location --fail --silent \${paperDownload} -o /minecraft/paper-mc.jar && \\
|
||||||
mkdir /minecraft/data && \\
|
mkdir /minecraft/data && \\
|
||||||
mkdir /minecraft/html && \\
|
mkdir /minecraft/html && \\
|
||||||
@ -90,7 +89,12 @@ CMD cd data; java -Xms${memoryMin} -Xmx${memoryMax} -jar ../paper-mc.jar
|
|||||||
|
|
||||||
stage ("Build & Push") {
|
stage ("Build & Push") {
|
||||||
container ("kaniko") {
|
container ("kaniko") {
|
||||||
sh "/kaniko/executor --cleanup --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/minecraft:latest\""
|
sh """
|
||||||
|
paperBuild=$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion} | jq '.builds | max')
|
||||||
|
paperFile=$(curl --silent --location --fail https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/${paperBuild} | jq '.downloads.application.name')
|
||||||
|
paperDownload="https://papermc.io/api/v2/projects/paper/versions/${paperVersion}/builds/${paperBuild}/downloads/\${paperFile}"
|
||||||
|
/kaniko/executor --cleanup --context "${workspace}" -f "${workspace}/Dockerfile" --destination "${repository}/library/minecraft:latest" --build-arg "paperDownload=${paperDownload}"
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user