docker-minecraft/build.sh

32 lines
764 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"
)
# Forge version dictionary (we only support one version per)
declare -A forgeversions=(
["1.16.5"]="36.2.22"
)
# 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