diff --git a/minecraft-server/Dockerfile b/minecraft-server/Dockerfile index c4fa71fc..f4b8cf5e 100644 --- a/minecraft-server/Dockerfile +++ b/minecraft-server/Dockerfile @@ -21,28 +21,22 @@ RUN useradd -M -s /bin/false --uid 1000 minecraft \ && mkdir /plugins \ && chown minecraft:minecraft /data /config /mods /plugins -EXPOSE 25565 -EXPOSE 25575 +EXPOSE 25565 25575 -COPY get-mcadmin-versions.sh /get-mcadmin-versions -RUN /get-mcadmin-versions https://mcadmin.net/ +ADD https://github.com/itzg/restify/releases/download/1.0.3/restify_linux_amd64 /usr/local/bin/restify COPY start.sh /start COPY start-minecraft.sh /start-minecraft +COPY mcadmin.jq /usr/share +RUN chmod +x /usr/local/bin/* -VOLUME ["/data"] -VOLUME ["/mods"] -VOLUME ["/config"] -VOLUME ["/plugins"] +VOLUME ["/data","/mods","/config","/plugins"] COPY server.properties /tmp/server.properties WORKDIR /data ENTRYPOINT [ "/start" ] -# Special marker ENV used by MCCY management tool -ENV MC_IMAGE=YES - -ENV UID=1000 GID=1000 -ENV MOTD A Minecraft Server Powered by Docker -ENV JVM_OPTS -Xmx1024M -Xms1024M -ENV TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \ - LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= +ENV UID=1000 GID=1000 \ + MOTD="A Minecraft Server Powered by Docker" \ + JVM_OPTS="-Xmx1024M -Xms1024M" \ + TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED LEVEL=world PVP=true DIFFICULTY=easy \ + LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= diff --git a/minecraft-server/get-mcadmin-versions.sh b/minecraft-server/get-mcadmin-versions.sh deleted file mode 100755 index 0f2b7ba3..00000000 --- a/minecraft-server/get-mcadmin-versions.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -if [ $# -lt 1 ]; then - echo Missing arg: URL - exit 1 -fi - -cd /tmp -wget -qO mcadmin-versions.jar https://bintray.com/itzgeoff/artifacts/download_file?file_path=me%2Fitzg%2Fmcadmin-versions%2F1.1.0%2Fmcadmin-versions-1.1.0.jar -wget -q http://central.maven.org/maven2/org/jsoup/jsoup/1.9.1/jsoup-1.9.1.jar - -java -jar mcadmin-versions.jar $1 > /tmp/mcadmin-versions.db -rm *.jar diff --git a/minecraft-server/mcadmin.jq b/minecraft-server/mcadmin.jq new file mode 100644 index 00000000..f363a509 --- /dev/null +++ b/minecraft-server/mcadmin.jq @@ -0,0 +1,7 @@ +.[] | + select(.elements | length > 1) | + select(.elements[].elements[] | select(.class == "version" and .text == $version)) | + .elements[].elements[] | + select(.class|contains("server-jar")) | + .elements[] | select(.name="a") | + .href diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index fc7caeba..9f6426a6 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -63,7 +63,8 @@ function downloadSpigot { ;; esac - downloadUrl=$(awk -F:: "\$1 == \"${match}\" && \$2 == \"${VANILLA_VERSION}\" {print \$3}" /tmp/mcadmin-versions.db) + downloadUrl=$(restify --class=jar-div https://mcadmin.net/ | \ + jq --arg version "$match $VANILLA_VERSION" -r -f /usr/share/mcadmin.jq) if [[ -n $downloadUrl ]]; then echo "Downloading $match" wget -q -O $SERVER "$downloadUrl" @@ -74,7 +75,7 @@ function downloadSpigot { fi else echo "ERROR: Version $VANILLA_VERSION is not supported for $TYPE" - echo " Refer to http://getspigot.org for supported versions" + echo " Refer to https://mcadmin.net/ for supported versions" exit 2 fi }