File size: 1,839 Bytes
a84e3af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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"]