FROM "${BASE_IMAGE:-localhost/minecraft-base}":"${BASE_TAG:-latest}" # Minecraft version ARG VERSION=latest # SpigotMC BuildTools URL ARG BASE_URL="https://hub.spigotmc.org/jenkins/job/BuildTools/" ARG ARTIFACT_PATH="lastSuccessfulBuild/artifact/target/BuildTools.jar" # Download files and run as user USER minecraft WORKDIR /app # Download and build Spigot using BuildTools RUN set -ux && \ # Grab latest version if not specified if [ "$VERSION" = "latest" ]; then \ VERSION="$( \ curl -s https://launchermeta.mojang.com/mc/game/version_manifest.json \ | jq -r '.latest.release' \ )"; \ fi && \ # Download BuildTools.jar curl -s -o BuildTools.jar "${BASE_URL}${ARTIFACT_PATH}" && \ ## Run BuildTools to build specified version java -jar BuildTools.jar --rev "$VERSION" --compile SPIGOT # Generate initial settings RUN java -jar server.jar --initSettings --nogui # Back to root to copy the entrypoint in USER root WORKDIR /app # Copy in entrypoint script COPY ../entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh # Run app as minecraft user USER minecraft WORKDIR /app # Expose port and run entrypoint script EXPOSE 25565 ENTRYPOINT ["entrypoint.sh"]