add minecraft version as env at runtime
This commit is contained in:
parent
878c146203
commit
f642050104
2 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue