6 Commits

4 changed files with 20 additions and 7 deletions

View File

@@ -3,12 +3,12 @@ FROM alpine:latest AS build
# Args # Args
ARG MINECRAFT_VERSION="1.16.5" ARG MINECRAFT_VERSION="1.16.5"
ARG FORGE_VERSION="36.1.13" ARG FORGE_VERSION="36.2.22"
# The actual setup work # The actual setup work
COPY start-server.sh /minecraft/start-server.sh COPY start-server.sh /minecraft/start-server.sh
WORKDIR /minecraft WORKDIR /minecraft
RUN apk add curl openjdk8-jre &&\ RUN apk add curl openjdk11-jre &&\
curl -L "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT_VERSION}-${FORGE_VERSION}/forge-${MINECRAFT_VERSION}-${FORGE_VERSION}-installer.jar" -o installer.jar &&\ 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 &&\ java -jar installer.jar --installServer &&\
echo "eula=true" > eula.txt &&\ echo "eula=true" > eula.txt &&\
@@ -16,7 +16,7 @@ RUN apk add curl openjdk8-jre &&\
ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar
# The second stage is the actual container # The second stage is the actual container
FROM openjdk:8 FROM openjdk:11
RUN apt-get update && apt-get install rsync screen -y RUN apt-get update && apt-get install rsync screen -y
WORKDIR /minecraft WORKDIR /minecraft
COPY --from=build /minecraft . COPY --from=build /minecraft .

View File

@@ -39,6 +39,7 @@ variable|description
`JRE_XMX`|Maximum amount of heap passed to the main Minecraft process `JRE_XMX`|Maximum amount of heap passed to the main Minecraft process
`JRE_XMS`|Minimum heap size passed to the main Minecraft process `JRE_XMS`|Minimum heap size passed to the main Minecraft process
`FORGE_PACK_ZIP`|If provided, the URL to a zip or tar.gz file that contains the modpack that needs to be installed. Will be intelligently extracted into the server directory through the magic of `find`. `FORGE_PACK_ZIP`|If provided, the URL to a zip or tar.gz file that contains the modpack that needs to be installed. Will be intelligently extracted into the server directory through the magic of `find`.
`CONFIG_REPO`|If provided, the URI to a git repository that contains configuration to copy over top the pack. The root of the repo will be the root of the server directory.
`ARGS`|Any additional arguments to be passed to the JVM `ARGS`|Any additional arguments to be passed to the JVM
## Useful Arguments ## Useful Arguments

View File

@@ -5,14 +5,12 @@
# MC version list # MC version list
declare -a mcversions=( declare -a mcversions=(
"1.12.2"
"1.16.5" "1.16.5"
) )
# Forge version dictionary (we only support one version per) # Forge version dictionary (we only support one version per)
declare -A forgeversions=( declare -A forgeversions=(
["1.12.2"]="14.23.5.2855" ["1.16.5"]="36.2.22"
["1.16.5"]="36.1.13"
) )
# Build images # Build images

View File

@@ -16,7 +16,18 @@ if [ -n "$FORGE_PACK_ZIP" ]; then
unzip pack.zip unzip pack.zip
directory="$(find . -type d -iname "mods" -execdir pwd \; | sort -n | head -n 1)" directory="$(find . -type d -iname "mods" -execdir pwd \; | sort -n | head -n 1)"
echo "Found modpack directory: $directory" echo "Found modpack directory: $directory"
rsync -av "$directory"/ /minecraft/ rsync -av --ignore-existing "$directory"/ /minecraft/
popd > /dev/null 2>&1
fi
# Then also download and extract a config repo, if one exists
if [ -n "$CONFIG_REPO" ]; then
echo "Downloading config repo: $CONFIG_REPO"
tmpdir="$(mktemp -d)"
pushd "$tmpdir" > /dev/null 2>&1
git clone "$CONFIG_REPO" .
rm -rf .git
rsync -av --delete ./ /minecraft/
popd > /dev/null 2>&1 popd > /dev/null 2>&1
fi fi
@@ -31,6 +42,9 @@ args="-jar server.jar nogui"
# Debugging info # Debugging info
java -version java -version
echo "Invoking java with args: $args" echo "Invoking java with args: $args"
echo
echo "To see the server console, execute this command in the container:"
echo " screen -r minecraft"
# Start 'er up # Start 'er up
cleanup() { cleanup() {