Skip to content

Instantly share code, notes, and snippets.

@strayer
Created May 24, 2016 08:48
Show Gist options
  • Save strayer/4ee48e16715c068304cc545c92cd37ab to your computer and use it in GitHub Desktop.
Save strayer/4ee48e16715c068304cc545c92cd37ab to your computer and use it in GitHub Desktop.
Spigot Dockerfile
FROM alpine:3.3
ENV SPIGOT_BUILDTOOLS_REV=1.8.8
RUN apk add --no-cache --repository http://dl-1.alpinelinux.org/alpine/edge/community/ tini && rm -rf /var/cache/apk/*
RUN apk add --no-cache openjdk8-jre && rm -rf /var/cache/apk/*
RUN apk add --no-cache --virtual=build-dependencies curl bash git grep && \
mkdir /tmp/minecraft-builder && \
cd /tmp/minecraft-builder && \
curl -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
bash -c "java -jar BuildTools.jar --rev ${SPIGOT_BUILDTOOLS_REV}" \
| egrep --line-buffered -v \
-e '^Download(ed|ing):\s+https?://(repo.maven.apache.org|hub.spigotmc.org|oss.sonatype.org|repo.md-5.net)' \
-e '^\s*$' \
-e '^([0-9/]+\s+K?B\s*)+$' \
-e '^INFO:\s+Decompiling class' \
-e '^INFO:\s+...\s+done\s*$' \
-e '^Extracted:\s+work/decompile' \
-e '^Extracted:\s+./apache-maven' \
&& \
mv spigot*.jar /spigot.jar && \
apk del --no-cache build-dependencies && \
rm -rf /tmp/* /var/cache/apk/* /root/.m2/
ENV SPIGOT_PORT=25565 \
SPIGOT_WORLDS_DIR=worlds \
SPIGOT_JVM_OPTS='-server -Xmx4g -Xms1g' \
SPIGOT_JVM_PROPERTIES='-Dcom.mojang.eula.agree=true -Djava.security.egd=file:/dev/./urandom' \
SPIGOT_CONFIG='--port ${SPIGOT_PORT} --world-dir ${SPIGOT_WORLDS_DIR}'
VOLUME ["/minecraft-server"]
EXPOSE ${SPIGOT_PORT}
WORKDIR /minecraft-server
ENTRYPOINT ["tini", "-v", "--"]
CMD ["sh", "-c", "java ${SPIGOT_JVM_OPTS} ${SPIGOT_JVM_PROPERTIES} -jar /spigot.jar $(sh -c \"echo ${SPIGOT_CONFIG}\")"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment