Use Alpine instead of the OpenJDK upstream image

Thinner and actually respects that JRE_VERSION var we added
This commit is contained in:
Salt 2022-05-17 11:07:10 -05:00
parent 4236f531da
commit 322b6f359d

View File

@ -6,7 +6,7 @@ ARG MINECRAFT_VERSION="1.16.5"
ARG FORGE_VERSION="36.2.26" ARG FORGE_VERSION="36.2.26"
ARG JRE_VERSION="openjdk8-jre" ARG JRE_VERSION="openjdk8-jre"
# The actual setup work # Build us up the basics of the Minecraft server environment
COPY start-server.sh /minecraft/start-server.sh COPY start-server.sh /minecraft/start-server.sh
WORKDIR /minecraft WORKDIR /minecraft
RUN apk add curl "${JRE_VERSION}" &&\ RUN apk add curl "${JRE_VERSION}" &&\
@ -16,9 +16,9 @@ RUN apk add curl "${JRE_VERSION}" &&\
rm installer.jar installer.jar.log && \ rm installer.jar installer.jar.log && \
ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar
# The second stage is the actual container # Stuff them in a smaller container with fewer layers
FROM openjdk:11 FROM alpine:latest
RUN apt-get update && apt-get install rsync screen -y RUN apk add bash rsync screen "${JRE_VERSION}"
WORKDIR /minecraft WORKDIR /minecraft
COPY --from=build /minecraft . COPY --from=build /minecraft .
CMD [ "bash", "start-server.sh" ] CMD [ "bash", "start-server.sh" ]