28 lines
970 B
Docker
28 lines
970 B
Docker
# The first stage just builds up the modpack
|
|
FROM alpine:latest AS build
|
|
|
|
# Args
|
|
ARG MINECRAFT_VERSION="1.16.5"
|
|
ARG FORGE_VERSION="36.2.26"
|
|
ARG JRE_VERSION="openjdk8-jre"
|
|
|
|
# Build us up the basics of the Minecraft server environment
|
|
COPY start-server.sh /minecraft/start-server.sh
|
|
WORKDIR /minecraft
|
|
RUN apk add curl &&\
|
|
apk add "${JRE_VERSION}" &&\
|
|
curl -L "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT_VERSION}-${FORGE_VERSION}/forge-${MINECRAFT_VERSION}-${FORGE_VERSION}-installer.jar" -o installer.jar &&\
|
|
java -jar installer.jar --installServer &&\
|
|
echo "eula=true" > eula.txt &&\
|
|
rm installer.jar installer.jar.log && \
|
|
ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar
|
|
|
|
# Stuff them in a smaller container with fewer layers
|
|
FROM alpine:latest AS final
|
|
RUN apk add bash rsync screen &&\
|
|
apk add "${JRE_VERSION}"
|
|
WORKDIR /minecraft
|
|
COPY --from=build /minecraft .
|
|
CMD [ "bash", "start-server.sh" ]
|
|
EXPOSE 25565
|