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" ]