2021-04-09 16:28:17 -05:00
|
|
|
# Args
|
|
|
|
ARG MINECRAFT_VERSION="1.16.5"
|
2022-02-09 15:57:14 -06:00
|
|
|
ARG FORGE_VERSION="36.2.26"
|
2022-05-17 10:53:13 -05:00
|
|
|
ARG JRE_VERSION="openjdk8-jre"
|
2021-04-09 16:28:17 -05:00
|
|
|
|
2022-06-14 14:10:19 -05:00
|
|
|
ARG UID=1520
|
|
|
|
ARG USER=minecraft
|
2022-06-14 14:14:21 -05:00
|
|
|
ARG GID=1520
|
|
|
|
ARG GROUP=minecraft
|
2022-06-14 14:10:19 -05:00
|
|
|
|
2022-05-17 11:33:48 -05:00
|
|
|
# The first stage just builds up the modpack
|
|
|
|
FROM alpine:latest AS build
|
|
|
|
|
|
|
|
# Use all of our arguments
|
|
|
|
ARG MINECRAFT_VERSION
|
|
|
|
ARG FORGE_VERSION
|
|
|
|
ARG JRE_VERSION
|
|
|
|
|
2022-05-17 11:07:10 -05:00
|
|
|
# Build us up the basics of the Minecraft server environment
|
2021-04-09 16:28:17 -05:00
|
|
|
COPY start-server.sh /minecraft/start-server.sh
|
|
|
|
WORKDIR /minecraft
|
2022-05-17 11:33:48 -05:00
|
|
|
RUN apk add curl "${JRE_VERSION}" &&\
|
2021-04-09 16:28:17 -05:00
|
|
|
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
|
|
|
|
|
2022-05-17 11:07:10 -05:00
|
|
|
# Stuff them in a smaller container with fewer layers
|
2022-05-17 11:24:15 -05:00
|
|
|
FROM alpine:latest AS final
|
2022-05-17 11:33:48 -05:00
|
|
|
|
|
|
|
# Use only a subset of arguments
|
|
|
|
ARG JRE_VERSION
|
2022-06-14 14:16:51 -05:00
|
|
|
ARG UID
|
|
|
|
ARG USER
|
|
|
|
ARG GID
|
|
|
|
ARG GROUP
|
2022-05-17 11:33:48 -05:00
|
|
|
|
|
|
|
# Build the thing up
|
2022-05-26 22:05:42 -05:00
|
|
|
RUN apk add bash curl findutils rsync screen "${JRE_VERSION}"
|
2022-06-14 14:16:51 -05:00
|
|
|
RUN addgroup -g "${GID}" "${USER}" && \
|
|
|
|
adduser -h /minecraft -s /bin/sh -G "${GROUP}" -D -H -u "${UID}"
|
2021-04-09 16:28:17 -05:00
|
|
|
WORKDIR /minecraft
|
|
|
|
COPY --from=build /minecraft .
|
2022-06-14 14:10:19 -05:00
|
|
|
USER $USER
|
2021-04-09 16:28:17 -05:00
|
|
|
CMD [ "bash", "start-server.sh" ]
|
|
|
|
EXPOSE 25565
|