File size: 790 Bytes
6d0bd44 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# Set the working directory to /minecraft
WORKDIR /minecraft
# Update package list and install necessary packages
RUN apt-get update && apt-get install -y \
openjdk-17-jdk \
wget \
&& rm -rf /var/lib/apt/lists/*
# Download the Minecraft server jar
RUN wget -O server.jar https://piston-data.mojang.com/v1/objects/4fb536bfd4a83d61cdbaf684b8d311e66e7d4c49/server.jar
# Accept the EULA
RUN echo "eula=true" > eula.txt
# Expose the Minecraft server port
EXPOSE 25565
# Use the user with ID 1000 to avoid permission issues
RUN useradd -m minecraft && chown -R minecraft /minecraft
USER minecraft
# Set the entrypoint and default command
ENTRYPOINT [ "java" ]
CMD ["-Xmx1024M", "-Xms1024M", "-jar", "server.jar", "nogui" ] |