docker-minecraft/build.sh

34 lines
796 B
Bash
Raw Normal View History

#! /bin/bash
#
# Build the Docker image for a series of different Forge versions
#
# MC version list
declare -a mcversions=(
"1.16.5"
2022-05-17 10:42:15 -05:00
"1.18.2"
)
# Forge version dictionary (we only support one version per)
declare -A forgeversions=(
2022-05-17 10:42:15 -05:00
["1.16.5"]="36.2.35"
["1.18.2"]="40.1.20"
)
# 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"
# --no-cache is required for clean builds
docker buildx build \
--build-arg MINECRAFT_VERSION="$mc" \
--build-arg FORGE_VERSION="$forge" \
--no-cache \
--platform linux/amd64 \
--tag "$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-$forge-${CI_COMMIT_REF_NAME:=bleeding}" \
--push \
.
done
docker images