Grt / Dockerfile
Tejasf's picture
Create Dockerfile
a84e3af verified
Raw
History Blame Contribute Delete
1.84 kB
# 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"]
# Use official OpenJDK 17 image
FROM openjdk:17-slim
# Install wget, curl, aur zaruri tools
RUN apt-get update && apt-get install -y wget curl jq screen && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /minecraft
# Download PaperMC (Optimized Minecraft Server)
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 Minecraft EULA
RUN echo "eula=true" > eula.txt
# Download Playit.gg for Global IP
RUN wget -O playit https://github.com/playit-cloud/playit-agent/releases/latest/download/playit-linux-amd64
RUN chmod +x playit
# Create a startup script jo Playit aur Server dono ko ek sath chalaye
RUN echo '#!/bin/bash\n\
echo "Starting Playit.gg in background..."\n\
./playit &\n\
echo "Starting Minecraft Server..."\n\
java -Xmx2G -Xms1G -jar server.jar nogui\n\
' > start.sh
RUN chmod +x start.sh
# Hugging Face default port expose karna zaruri hai
EXPOSE 7860
# Run the startup script
CMD ["./start.sh"]