FROM ubuntu:24.04 # Install required packages (Java, wget, python, screen) + add playit.gg repo and install playit RUN apt-get update && \ apt-get install -y openjdk-21-jre-headless wget python3 screen gpg curl && \ curl -SsL https://playit-cloud.github.io/ppa/key.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/playit.gpg >/dev/null && \ echo "deb [signed-by=/etc/apt/trusted.gpg.d/playit.gpg] https://playit-cloud.github.io/ppa/data ./" | tee /etc/apt/sources.list.d/playit-cloud.list && \ apt-get update && \ apt-get install -y playit && \ rm -rf /var/lib/apt/lists/* # Create Minecraft directory and download server JAR RUN mkdir -p /opt/minecraft && \ wget -O /opt/minecraft/server.jar https://piston-data.mojang.com/v1/objects/95495a7f485eedd84ce928cef5e223b757d2f764/server.jar WORKDIR /opt/minecraft # Accept EULA RUN echo "eula=true" > eula.txt # Copy start script COPY start.sh /opt/minecraft/start.sh RUN chmod +x start.sh # --- THE PERMISSION FIX --- # Change ownership of the minecraft directory to the non-root user (UID 1000) # that Hugging Face Spaces uses to run the container. RUN chown -R 1000:1000 /opt/minecraft # Expose dummy port for HF EXPOSE 7860 # Run start script CMD ["/opt/minecraft/start.sh"]