riddhiman commited on
Commit
47b8751
·
verified ·
1 Parent(s): ece9c0f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -9,13 +9,16 @@ EXPOSE 7860
9
  ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
10
  ENV EULA=true
11
 
12
- # Adjust file permissions to ensure the directory can be written to
13
- RUN mkdir -p /minecraft/cache && chown -R 1000:1000 /minecraft
14
-
15
- # Add a non-root user in a more compatible way and take over ownership
16
- RUN useradd -r -m -d /minecraft -s /bin/bash minecraft && \
17
- chown -R minecraft:minecraft /minecraft
18
 
19
  USER minecraft
20
 
21
- 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
 
 
 
 
9
  ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
10
  ENV EULA=true
11
 
12
+ # Create a new user and adjust permissions accordingly
13
+ # -m creates the user's home directory
14
+ # -d specifies the user's home directory
15
+ # -s specifies the user's shell
16
+ # Using /bin/false to disable shell access for the user
17
+ RUN useradd -m -d /minecraft -s /bin/false minecraft && chown -R minecraft:minecraft /minecraft
18
 
19
  USER minecraft
20
 
21
+ CMD if [ "${EULA}" != "true" ]; then \
22
+ echo "You must accept the Minecraft EULA by setting the EULA env variable to TRUE."; exit 1; \
23
+ fi && \
24
+ java ${JAVA_OPTS} -jar server.jar --nogui --port 7860