2021-05-22 00:07:13 -05:00
|
|
|
#! /bin/bash
|
|
|
|
#
|
|
|
|
# Build the Docker image for a series of different Forge versions
|
|
|
|
#
|
|
|
|
|
|
|
|
# MC version list
|
2022-05-17 10:53:13 -05:00
|
|
|
readonly -a mcversions=(
|
|
|
|
"1.12.2"
|
2021-05-22 00:07:13 -05:00
|
|
|
"1.16.5"
|
2022-05-17 10:42:15 -05:00
|
|
|
"1.18.2"
|
2021-05-22 00:07:13 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# Forge version dictionary (we only support one version per)
|
2022-05-17 10:53:13 -05:00
|
|
|
readonly -A forgeversions=(
|
|
|
|
["1.12.2"]="14.23.5.2855"
|
2022-05-17 10:42:15 -05:00
|
|
|
["1.16.5"]="36.2.35"
|
|
|
|
["1.18.2"]="40.1.20"
|
2021-05-22 00:07:13 -05:00
|
|
|
)
|
|
|
|
|
2022-05-17 10:53:13 -05:00
|
|
|
# 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"
|
|
|
|
)
|
|
|
|
|
2021-05-22 00:07:13 -05:00
|
|
|
# Build images
|
|
|
|
docker buildx create --use
|
|
|
|
for mc in ${mcversions[@]}; do
|
|
|
|
forge="${forgeversions[$mc]}"
|
2022-05-17 10:53:13 -05:00
|
|
|
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"
|
2021-05-22 00:14:16 -05:00
|
|
|
# --no-cache is required for clean builds
|
2021-05-22 00:07:13 -05:00
|
|
|
docker buildx build \
|
2021-05-22 00:14:16 -05:00
|
|
|
--build-arg MINECRAFT_VERSION="$mc" \
|
|
|
|
--build-arg FORGE_VERSION="$forge" \
|
2022-05-17 10:53:13 -05:00
|
|
|
--build-arg JRE_VERSION="$jre" \
|
2021-05-22 00:14:16 -05:00
|
|
|
--no-cache \
|
2021-05-22 00:07:13 -05:00
|
|
|
--platform linux/amd64 \
|
2022-05-17 10:53:13 -05:00
|
|
|
--tag "$tag" \
|
2021-05-22 00:07:13 -05:00
|
|
|
--push \
|
|
|
|
.
|
|
|
|
done
|
|
|
|
docker images
|