Fix JRE_VERSION being unscoped in the final stage

This commit is contained in:
Salt 2022-05-17 11:33:48 -05:00
parent a107b4b76e
commit 025d88f7e0
1 changed files with 15 additions and 7 deletions

View File

@ -1,16 +1,20 @@
# 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"
# 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
# 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}" &&\
RUN apk add curl "${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 &&\
@ -19,8 +23,12 @@ RUN apk add curl &&\
# Stuff them in a smaller container with fewer layers
FROM alpine:latest AS final
RUN apk add bash rsync screen &&\
apk add "${JRE_VERSION}"
# Use only a subset of arguments
ARG JRE_VERSION
# Build the thing up
RUN apk add bash rsync screen "${JRE_VERSION}"
WORKDIR /minecraft
COPY --from=build /minecraft .
CMD [ "bash", "start-server.sh" ]