From 484d12463a69a6f6fb81d08ac3fa6ebf1e015eaf Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Thu, 19 Dec 2024 15:08:41 +0100 Subject: [PATCH] feat: update server on start --- .../Resources/files/template/Dockerfile | 5 ++--- .../Resources/files/template/entrypoint | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Minecraft-Realms-Emulator/Resources/files/template/Dockerfile b/Minecraft-Realms-Emulator/Resources/files/template/Dockerfile index a22bd68..c95769f 100644 --- a/Minecraft-Realms-Emulator/Resources/files/template/Dockerfile +++ b/Minecraft-Realms-Emulator/Resources/files/template/Dockerfile @@ -3,7 +3,7 @@ FROM eclipse-temurin:21-jre-alpine COPY . . RUN apk upgrade -RUN apk add openssl +RUN apk add openssl curl jq RUN wget -O rcon-cli.tar.gz https://github.com/itzg/rcon-cli/releases/download/1.6.7/rcon-cli_1.6.7_linux_amd64.tar.gz RUN tar xzf rcon-cli.tar.gz @@ -12,7 +12,6 @@ RUN rm rcon-cli.tar.gz RUN mv rcon-cli /bin/rcon-cli WORKDIR mc -RUN wget -O server.jar https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar - EXPOSE 25565 + ENTRYPOINT ["/entrypoint"] \ No newline at end of file diff --git a/Minecraft-Realms-Emulator/Resources/files/template/entrypoint b/Minecraft-Realms-Emulator/Resources/files/template/entrypoint index 8e4ad6e..76c4a7b 100644 --- a/Minecraft-Realms-Emulator/Resources/files/template/entrypoint +++ b/Minecraft-Realms-Emulator/Resources/files/template/entrypoint @@ -11,4 +11,12 @@ if [ ! -f server.properties ]; then echo "level-name=slot-1" >> server.properties fi +# Download latest server.jar +if [ ! -f .no-update ]; then + VERSION_URL=$(curl https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.release as $latest | .versions | to_entries[] | select(.value.id == $latest) | .value.url') + SERVER_URL=$(curl $VERSION_URL | jq -r .downloads.server.url) + + wget -O server.jar $SERVER_URL +fi + java -jar server.jar \ No newline at end of file