minecraft-forge/Dockerfile

38 lines
1.3 KiB
Text
Raw Normal View History

FROM openjdk:8-jre-slim
EXPOSE 25565
ARG MINECRAFT=1.7.10
ARG FORGE=10.13.4.1641
ENV \
ForgeUrl1=http://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT}-${FORGE}/forge-${MINECRAFT}-${FORGE}-installer.jar \
ForgeUrl2=http://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT}-${FORGE}-${MINECRAFT}/forge-${MINECRAFT}-${FORGE}-${MINECRAFT}-installer.jar \
InstallerJar=forge-${MINECRAFT}-${FORGE}-installer.jar
ENV \
INSTDIR=/usr/share/minecraft \
RUNDIR=/minecraft
RUN useradd -U -d /minecraft -m forge
WORKDIR $INSTDIR
# Since the URL schema changed, we need to try both after another.
# Prepare the server files and remove the installer.
# The EULA needs to be present, so we also accept it at this point.
# The remaining jar beginning with forge-* is the launcher (multiple names
# possible), so we will symlink it to forge.jar for convenience.
RUN ( wget -O ${InstallerJar} ${ForgeUrl1} || wget -O ${InstallerJar} ${ForgeUrl2} ) && \
echo "eula=true" > eula.txt && \
java -jar ./${InstallerJar} --installServer && rm -f ${InstallerJar} && \
ln -s "forge-${MINECRAFT}-*.jar" forge.jar || exit 2
COPY entrypoint.sh /usr/bin
WORKDIR $RUNDIR
VOLUME ["/minecraft"]
ENTRYPOINT ["/usr/bin/entrypoint.sh"]