From f642050104abc3bd00cf202fc5bc077b96978632 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 10 Aug 2025 12:50:22 -0600 Subject: [PATCH] add minecraft version as env at runtime --- context/Dockerfile | 2 +- context/run-server | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/context/Dockerfile b/context/Dockerfile index eef3239..c7e3266 100644 --- a/context/Dockerfile +++ b/context/Dockerfile @@ -20,7 +20,7 @@ ARG MINECRAFT_VERSION="1.20.6" RUN apk add --no-cache --upgrade rcon eudev-libs WORKDIR / COPY ./run-server /usr/local/bin/ -RUN sed -i "s|VERSION|${MINECRAFT_VERSION}|g" /usr/local/bin/run-server +RUN sed -i "s|SED_VERSION|${MINECRAFT_VERSION}|g" /usr/local/bin/run-server ARG UID="1000" ARG GID="1000" RUN adduser -D -H -u $UID -h /tmp user diff --git a/context/run-server b/context/run-server index 419b926..20549b5 100755 --- a/context/run-server +++ b/context/run-server @@ -1,4 +1,5 @@ #!/bin/sh +export MINECRAFT_VERSION=SED_VERSION cleanup() { rcon -m -p 25575 --host localhost --password "${MC_RCON_PASSWORD}" say Warning! Server is shutting down in 5 seconds... @@ -10,7 +11,7 @@ cd /server envsubst < /spigot/server.properties.in > /server/server.properties [ "$ACCEPT_EULA" = "true" ] && echo eula=true > /server/eula.txt -java -Xmx${SERVER_MEMORY:-6G} -jar /spigot/spigot-VERSION.jar nogui & +java -Xmx${SERVER_MEMORY:-6G} -jar /spigot/spigot-SED_VERSION.jar nogui & trap "cleanup" INT # wait twice in the event sigint (docker stop) is received