FROM alpine:edge AS buildtools ARG VERSION RUN apk add git openjdk17 curl RUN adduser -D buildtools USER buildtools WORKDIR /home/buildtools RUN curl -o buildtools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar RUN java -jar buildtools.jar --rev $VERSION RUN mv ./spigot-$VERSION.jar ./spigot.jar FROM openjdk:latest AS minecraft-paper RUN mkdir /usr/games/minecraft-spigot /usr/games/minecraft-spigot/data RUN chown -R games /usr/games USER games WORKDIR /usr/games/minecraft-spigot COPY --chown=games:users --from=buildtools /home/buildtools/spigot.jar ./spigot.jar WORKDIR /usr/games/minecraft-spigot/data CMD [ "java", "-jar", "../spigot.jar" ]