rastof9 commited on
Commit
09f048b
·
verified ·
1 Parent(s): 2069803

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -4
Dockerfile CHANGED
@@ -5,16 +5,18 @@ FROM eclipse-temurin:21-jre-jammy
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"]
 
5
  WORKDIR /server
6
 
7
  # Step 3: Download the official Minecraft server (version 1.21)
 
8
  RUN apt-get update && apt-get install -y wget && \
9
  wget https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar
10
 
11
  # Step 4: Accept the Minecraft EULA
12
  RUN echo "eula=true" > eula.txt
13
 
14
+ # Step 5: NEW! Change ownership of the /server directory to the correct user
15
+ # This gives the server permission to write its own files.
16
+ RUN chown -R 1000:1000 /server
17
+
18
+ # Step 6: Expose the default Minecraft port
19
  EXPOSE 25565
20
 
21
+ # Step 7: Start the server directly, with full control over memory.
 
22
  CMD ["java", "-Xms512M", "-Xmx1G", "-jar", "server.jar", "nogui"]