Update Dockerfile
Browse files- Dockerfile +18 -6
Dockerfile
CHANGED
|
@@ -1,8 +1,20 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Step 1: Start from a clean Java 21 environment
|
| 2 |
+
FROM eclipse-temurin:21-jre-jammy
|
| 3 |
|
| 4 |
+
# Step 2: Set the working directory for our server files
|
| 5 |
+
WORKDIR /server
|
| 6 |
|
| 7 |
+
# Step 3: Download the official Minecraft server (version 1.21)
|
| 8 |
+
# NOTE: This download link is for the latest version as of this writing.
|
| 9 |
+
RUN apt-get update && apt-get install -y wget && \
|
| 10 |
+
wget https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar
|
| 11 |
+
|
| 12 |
+
# Step 4: Accept the Minecraft EULA
|
| 13 |
+
RUN echo "eula=true" > eula.txt
|
| 14 |
+
|
| 15 |
+
# Step 5: Expose the default Minecraft port
|
| 16 |
+
EXPOSE 25565
|
| 17 |
+
|
| 18 |
+
# Step 6: Start the server directly, with full control over memory.
|
| 19 |
+
# We are forcing it to start with 512MB and use a maximum of 1GB of RAM.
|
| 20 |
+
CMD ["java", "-Xms512M", "-Xmx1G", "-jar", "server.jar", "nogui"]
|