rastof9 commited on
Commit
2069803
·
verified ·
1 Parent(s): 2d2483c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -6
Dockerfile CHANGED
@@ -1,8 +1,20 @@
1
- # Use the official itzg/minecraft-server image
2
- FROM itzg/minecraft-server:latest
3
 
4
- # You MUST accept the EULA to run the server
5
- ENV EULA=TRUE
6
 
7
- # Force Java to use a small amount of memory
8
- ENV JVM_OPTS="-Xms256M -Xmx512M"
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]