Update Dockerfile
Browse files- Dockerfile +10 -7
Dockerfile
CHANGED
|
@@ -9,13 +9,16 @@ EXPOSE 7860
|
|
| 9 |
ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
|
| 10 |
ENV EULA=true
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
USER minecraft
|
| 20 |
|
| 21 |
-
CMD if [ "${EULA}" != "true" ]; then
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|