Modularize the addition of OpenJDK, enabling branch convergence
This commit is contained in:
parent
18994698db
commit
f62c82e61a
@ -4,11 +4,12 @@ FROM alpine:latest AS build
|
||||
# Args
|
||||
ARG MINECRAFT_VERSION="1.16.5"
|
||||
ARG FORGE_VERSION="36.2.26"
|
||||
ARG JRE_VERSION="openjdk8-jre"
|
||||
|
||||
# The actual setup work
|
||||
COPY start-server.sh /minecraft/start-server.sh
|
||||
WORKDIR /minecraft
|
||||
RUN apk add curl openjdk11-jre &&\
|
||||
RUN apk add curl "${JRE_VERSION}" &&\
|
||||
curl -L "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT_VERSION}-${FORGE_VERSION}/forge-${MINECRAFT_VERSION}-${FORGE_VERSION}-installer.jar" -o installer.jar &&\
|
||||
java -jar installer.jar --installServer &&\
|
||||
echo "eula=true" > eula.txt &&\
|
||||
|
25
build.sh
25
build.sh
@ -4,29 +4,46 @@
|
||||
#
|
||||
|
||||
# MC version list
|
||||
declare -a mcversions=(
|
||||
readonly -a mcversions=(
|
||||
"1.12.2"
|
||||
"1.16.5"
|
||||
"1.18.2"
|
||||
)
|
||||
|
||||
# Forge version dictionary (we only support one version per)
|
||||
declare -A forgeversions=(
|
||||
readonly -A forgeversions=(
|
||||
["1.12.2"]="14.23.5.2855"
|
||||
["1.16.5"]="36.2.35"
|
||||
["1.18.2"]="40.1.20"
|
||||
)
|
||||
|
||||
# JRE versions (in the form of Alpine packages)
|
||||
readonly -A jreversions=(
|
||||
["1.12.2"]="openjdk8-jre"
|
||||
["1.16.5"]="openjdk11-jre"
|
||||
["1.18.2"]="openjdk11-jre"
|
||||
)
|
||||
|
||||
# Build images
|
||||
docker buildx create --use
|
||||
for mc in ${mcversions[@]}; do
|
||||
forge="${forgeversions[$mc]}"
|
||||
echo "Building image for Minecraft $mc, Forge $forge, CI_COMMIT_REF_NAME of $CI_COMMIT_REF_NAME"
|
||||
jre="${jreversions[$mc]}"
|
||||
tag="$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-$forge-$jre-${CI_COMMIT_REF_NAME:=bleeding}"
|
||||
echo "Building image..."
|
||||
echo " Minecraft: $mc"
|
||||
echo " Forge: $forge"
|
||||
echo " JRE: $jre"
|
||||
echo " Ref: $CI_COMMIT_REF_NAME"
|
||||
echo "Dockerhub tag: $tag"
|
||||
# --no-cache is required for clean builds
|
||||
docker buildx build \
|
||||
--build-arg MINECRAFT_VERSION="$mc" \
|
||||
--build-arg FORGE_VERSION="$forge" \
|
||||
--build-arg JRE_VERSION="$jre" \
|
||||
--no-cache \
|
||||
--platform linux/amd64 \
|
||||
--tag "$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-$forge-${CI_COMMIT_REF_NAME:=bleeding}" \
|
||||
--tag "$tag" \
|
||||
--push \
|
||||
.
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user