2021-01-26 13:45:30 +01:00
|
|
|
FROM openjdk:8-jre-slim
|
2020-12-30 14:02:22 +01:00
|
|
|
|
|
|
|
# Build arguments
|
|
|
|
ARG MC_VERSION
|
|
|
|
ARG FORGE_VERSION
|
|
|
|
|
2021-01-26 13:45:30 +01:00
|
|
|
# Install mcstatus for healthchecks
|
|
|
|
RUN apt update && \
|
|
|
|
apt install --no-install-recommends -y python3-minimal python3-setuptools python3-pip && \
|
|
|
|
python3 -m pip install mcstatus && \
|
|
|
|
apt --purge remove -y python3-pip python3-setuptools && \
|
|
|
|
apt clean
|
|
|
|
|
2020-12-30 14:02:22 +01:00
|
|
|
# Create worlds and config directory
|
2021-01-26 13:45:30 +01:00
|
|
|
WORKDIR /app
|
2020-12-30 14:02:22 +01:00
|
|
|
RUN mkdir worlds config
|
|
|
|
|
|
|
|
# Download installer jar
|
|
|
|
ADD "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MC_VERSION}-${FORGE_VERSION}/forge-${MC_VERSION}-${FORGE_VERSION}-installer.jar" installer.jar
|
|
|
|
|
2020-12-30 15:57:45 +01:00
|
|
|
# Install forge & remove installer
|
2020-12-30 14:02:22 +01:00
|
|
|
RUN java -jar installer.jar server --installServer && \
|
2021-01-26 13:45:30 +01:00
|
|
|
rm installer.jar installer.jar.log
|
2020-12-30 15:57:45 +01:00
|
|
|
|
2020-12-30 14:02:22 +01:00
|
|
|
# Store the cache in an anonymous volume, which means it won't get stored in the other volumes
|
|
|
|
VOLUME /mc/config/cache
|
|
|
|
|
|
|
|
WORKDIR /mc/config
|
|
|
|
|
|
|
|
# Default value to keep users from eating up all ram accidentally
|
2021-01-26 13:45:30 +01:00
|
|
|
ENV XMX=4
|
|
|
|
ENV MC_VERSION="${MC_VERSION}"
|
|
|
|
ENV FORGE_VERSION="${FORGE_VERSION}"
|
|
|
|
# Forge doesn't use one single name, so this is needed to know the name of the executable
|
|
|
|
ENV FORGE_JAR="forge-${MC_VERSION}-${FORGE_VERSION}.jar"
|
|
|
|
|
|
|
|
# Entrypoint runs in /app/config
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
WORKDIR /app/config
|
|
|
|
ENTRYPOINT /entrypoint.sh
|
2020-12-30 14:02:22 +01:00
|
|
|
|
2021-01-26 13:45:30 +01:00
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
|
|
CMD mcstatus localhost:25565 ping
|