From f6465b5dacc5eb17c69fe8a767d72cb190a6e01b Mon Sep 17 00:00:00 2001 From: Michael Reichenbach Date: Sat, 12 Jan 2019 16:32:30 +0100 Subject: [PATCH] feat(minecraft-server): add server-name to env variables The server-name (e.g. needed for bungeecord) can now be set via the env variable SERVER_NAME. Defaults to Unknown --- minecraft-server/Dockerfile | 28 +++++++++---------- minecraft-server/README.md | 5 ++++ .../start-finalSetup04ServerProperties | 1 + 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index d3555f4e..350a56bc 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -3,19 +3,19 @@ FROM openjdk:8u171-jre-alpine LABEL maintainer "itzg" RUN apk add --no-cache -U \ - openssl \ - imagemagick \ - lsof \ - su-exec \ - shadow \ - bash \ - curl iputils wget \ - git \ - jq \ - mysql-client \ - tzdata \ - rsync \ - python python-dev py2-pip + openssl \ + imagemagick \ + lsof \ + su-exec \ + shadow \ + bash \ + curl iputils wget \ + git \ + jq \ + mysql-client \ + tzdata \ + rsync \ + python python-dev py2-pip RUN pip install mcstatus @@ -71,7 +71,7 @@ ENV UID=1000 GID=1000 \ JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ - LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true + LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME=Unknown COPY start* / RUN dos2unix /start* && chmod +x /start* diff --git a/minecraft-server/README.md b/minecraft-server/README.md index e9da676e..8fa4240a 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -435,6 +435,11 @@ this server instance. ## Server configuration +### Server name + +The server name (e.g. for bungeecord) can be set like: + docker run -d -e SERVER_NAME=MyServer ... + ### Server port The server port can be set like: diff --git a/minecraft-server/start-finalSetup04ServerProperties b/minecraft-server/start-finalSetup04ServerProperties index e07aa0bc..17cd52ab 100755 --- a/minecraft-server/start-finalSetup04ServerProperties +++ b/minecraft-server/start-finalSetup04ServerProperties @@ -50,6 +50,7 @@ if [ ! -e $SERVER_PROPERTIES ]; then MOTD="A ${label} Minecraft Server powered by Docker" fi + setServerProp "server-name" "$SERVER_NAME" setServerProp "server-port" "$SERVER_PORT" setServerProp "motd" "$MOTD" setServerProp "allow-nether" "$ALLOW_NETHER"