riddhiman commited on
Commit
d8af812
·
verified ·
1 Parent(s): cdcdf07

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -10
Dockerfile CHANGED
@@ -1,14 +1,22 @@
1
- # Use the itzg/minecraft-server image as the base
2
- FROM itzg/minecraft-server
3
 
4
- # While we cannot directly translate the -p or --name flags into a Dockerfile
5
- # those are runtime parameters, you can specify EXPOSE to hint at ports to be mapped
 
 
 
 
 
 
 
 
 
6
  EXPOSE 7860
7
 
8
- # The ENTRYPOINT or CMD from the base image (itzg/minecraft-server) is already set to run the server
9
- # If you need to customize server properties or configurations, you could add COPY or RUN instructions here
10
- # For example:
11
- # COPY server.properties /data/server.properties
12
 
13
- # Note: Environment variables can be set with ENV commands if you need to configure the Minecraft server further
14
- ENV EULA=TRUE
 
1
+ # Use an official OpenJDK image for Java 17 as a parent image
2
+ FROM openjdk:17
3
 
4
+ # Optional: Set the environment variable for Java's memory usage
5
+ # Adjust Xmx and Xms values according to your server's specifications
6
+ ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
7
+
8
+ # Create a directory for the Minecraft server
9
+ WORKDIR /minecraft
10
+
11
+ # Copy the Minecraft server's JAR file into the container's working directory
12
+ COPY server.jar /minecraft
13
+
14
+ # Expose the Minecraft server port
15
  EXPOSE 7860
16
 
17
+ # Agree to Minecraft's EULA. Change this only if you have.
18
+ # It is important to understand and agree to EULA before changing it to TRUE.
19
+ ENV EULA=true
 
20
 
21
+ # Run the Minecraft server command. Replace 'server.jar' with the name of your server jar file, if different.
22
+ CMD if [ "${EULA}" != "true" ]; then echo "You must accept the Minecraft EULA by setting the EULA env variable to TRUE."; exit 1; fi && java ${JAVA_OPTS} -jar server.jar --nogui --port 7860