2021-05-22 00:07:13 -05:00
|
|
|
#! /bin/bash
|
|
|
|
#
|
|
|
|
# Build the Docker image for a series of different Forge versions
|
|
|
|
#
|
2022-05-17 11:12:16 -05:00
|
|
|
set -e
|
|
|
|
|
2021-05-22 00:07:13 -05:00
|
|
|
# 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]}"
|
2022-05-17 11:22:22 -05:00
|
|
|
CI_HUB_USERNAME="${CI_HUB_USERNAME:=rehashedsalt}"
|
|
|
|
CI_PROJECT_NAME="${CI_PROJECT_NAME:=minecraft-forge}"
|
2022-06-14 13:59:11 -05:00
|
|
|
tag="$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-${CI_COMMIT_REF_NAME:=bleeding}"
|
2022-05-17 10:53:13 -05:00
|
|
|
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 11:24:15 -05:00
|
|
|
--progress plain \
|
2022-05-17 10:53:13 -05:00
|
|
|
--tag "$tag" \
|
2021-05-22 00:07:13 -05:00
|
|
|
--push \
|
|
|
|
.
|
|
|
|
done
|
|
|
|
docker images
|