Dockerfile 885 B

123456789101112131415161718192021222324
  1. FROM openjdk:18-alpine
  2. WORKDIR /opt/
  3. ENV MIN_MEM=512m MAX_MEM=4G
  4. ARG VERSION=1.18.1
  5. # download+unpack & move configs to 1 folder
  6. # this allows for less volumes
  7. # ty @Roemer for the idea
  8. RUN apk add curl && \
  9. curl -sSL $(curl -sSL https://mcversions.net/download/${VERSION} | grep -o 'https://launcher.mojang.com.*server.jar') -o server.jar && \
  10. apk del curl && \
  11. echo "eula=true" > eula.txt && \
  12. mkdir config && \
  13. touch config/server.properties config/ops.json config/whitelist.json config/banned-ips.json config/banned-players.json && \
  14. ln -s config/server.properties server.properties && \
  15. ln -s config/ops.json ops.json && \
  16. ln -s config/whitelist.json whitelist.json && \
  17. ln -s config/banned-ips.json banned-ips.json && \
  18. ln -s config/banned-players.json banned-players.json
  19. CMD java -Xms${MIN_MEM} -Xmx${MAX_MEM} -jar server.jar nogui