Update Dockerfile
Browse files- Dockerfile +5 -17
Dockerfile
CHANGED
|
@@ -1,18 +1,9 @@
|
|
| 1 |
-
FROM openjdk:21
|
| 2 |
-
|
| 3 |
-
# Install git
|
| 4 |
-
RUN apt-get update && apt-get install -y git
|
| 5 |
|
| 6 |
WORKDIR /minecraft
|
| 7 |
|
| 8 |
-
# Copy the Minecraft server JAR
|
| 9 |
COPY server.jar /minecraft
|
| 10 |
-
COPY upload_world.sh /minecraft/upload_world.sh
|
| 11 |
-
COPY download_world.sh /minecraft/download_world.sh
|
| 12 |
-
|
| 13 |
-
# Make the scripts executable
|
| 14 |
-
RUN chmod +x /minecraft/upload_world.sh
|
| 15 |
-
RUN chmod +x /minecraft/download_world.sh
|
| 16 |
|
| 17 |
# Exposing the Minecraft server port
|
| 18 |
EXPOSE 7860
|
|
@@ -20,15 +11,12 @@ EXPOSE 7860
|
|
| 20 |
# Setting the JVM options
|
| 21 |
ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
|
| 22 |
|
| 23 |
-
# Automatically agree to the EULA
|
|
|
|
| 24 |
RUN echo "eula=true" > /minecraft/eula.txt
|
| 25 |
|
| 26 |
# Create a user as running as root is not advisable
|
| 27 |
RUN useradd -m -d /minecraft -s /bin/false minecraft && chown -R minecraft:minecraft /minecraft
|
| 28 |
-
|
| 29 |
-
# Load environment variables
|
| 30 |
-
RUN export $(cat /minecraft/.env | xargs)
|
| 31 |
-
|
| 32 |
USER minecraft
|
| 33 |
|
| 34 |
-
CMD
|
|
|
|
| 1 |
+
FROM openjdk:21
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /minecraft
|
| 4 |
|
| 5 |
+
# Copy the Minecraft server JAR
|
| 6 |
COPY server.jar /minecraft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Exposing the Minecraft server port
|
| 9 |
EXPOSE 7860
|
|
|
|
| 11 |
# Setting the JVM options
|
| 12 |
ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
|
| 13 |
|
| 14 |
+
# Automatically agree to the EULA. Note: Make sure you have
|
| 15 |
+
# actually read and agree to the EULA at https://account.mojang.com/documents/minecraft_eula
|
| 16 |
RUN echo "eula=true" > /minecraft/eula.txt
|
| 17 |
|
| 18 |
# Create a user as running as root is not advisable
|
| 19 |
RUN useradd -m -d /minecraft -s /bin/false minecraft && chown -R minecraft:minecraft /minecraft
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
USER minecraft
|
| 21 |
|
| 22 |
+
CMD java ${JAVA_OPTS} -jar server.jar --nogui --port 7860
|