mc_test / Dockerfile
riddhiman's picture
Update Dockerfile
03a904d verified
raw
history blame contribute delete
620 Bytes
FROM openjdk:21
WORKDIR /minecraft
# Copy the Minecraft server JAR
COPY server.jar /minecraft
# Exposing the Minecraft server port
EXPOSE 7860
# Setting the JVM options
ENV JAVA_OPTS="-Xmx1024M -Xms1024M"
# Automatically agree to the EULA. Note: Make sure you have
# actually read and agree to the EULA at https://account.mojang.com/documents/minecraft_eula
RUN echo "eula=true" > /minecraft/eula.txt
# Create a user as running as root is not advisable
RUN useradd -m -d /minecraft -s /bin/false minecraft && chown -R minecraft:minecraft /minecraft
USER minecraft
CMD java ${JAVA_OPTS} -jar server.jar --port 7860