# Use official OpenJDK image for Minecraft FROM openjdk:17-slim # Install wget and curl for downloading server files RUN apt-get update && apt-get install -y wget curl git && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /minecraft # Download PaperMC (Much better performance than vanilla) RUN wget -O server.jar https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/496/downloads/paper-1.20.4-496.jar # Accept EULA automatically RUN echo "eula=true" > eula.txt # Configure server properties for Hugging Face (Port 7860 is mandatory) RUN echo "server-port=7860\nquery.port=7860\nview-distance=6\nmax-players=10" > server.properties # Expose the default Hugging Face port EXPOSE 7860 # Start the Minecraft Server with optimized RAM flags CMD ["java", "-Xmx2G", "-Xms1G", "-jar", "server.jar", "nogui"]