Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041# 1. Base ImageFROM python:3.10-slim# 2. Install System Dependencies (Fixes for Debian Trixie)RUN apt-get update && apt-get install -y \wget \gnupg \unzip \xvfb \libgl1 \libglx-mesa0 \libnss3 \libxss1 \libasound2 \libatk-bridge2.0-0 \libgtk-3-0 \chromium \chromium-driver \&& rm -rf /var/lib/apt/lists/*# 3. Environment Setup# We force the display to 99 so the bot can "see" without a monitorENV DISPLAY=:99ENV PYTHONUNBUFFERED=1WORKDIR /app# 4. Install Python RequirementsCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# 5. Copy App CodeCOPY . .# 6. EXPOSE the Port# This tells Hugging Face that port 7860 is where the website livesEXPOSE 7860# 7. The Launch Command# We start the Virtual Screen (Xvfb) first, then run the Python appCMD ["sh", "-c", "Xvfb :99 -screen 0 1280x720x24 & python app.py"]1234567891011121314151617181920212223242526272829# Use a Python base with high compatibilityFROM python:3.10-slim# Install system dependencies for Chromium, Xvfb, and OpenGL (for game rendering)RUN apt-get update && apt-get install -y \wget gnupg unzip xvfb libgl1-mesa-dri libglapi-mesa libosmesa6 \libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 \chromium chromium-driver \&& rm -rf /var/lib/apt/lists/*# Create a non-root user for Hugging Face SpacesRUN useradd -m -u 1000 userUSER userENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \DISPLAY=:99 \PYTHONUNBUFFERED=1WORKDIR $HOME/app# Install Python requirementsCOPY --chown=user requirements.txt .RUN pip install --no-cache-dir -r requirements.txt# Copy the rest of the applicationCOPY --chown=user . .# Launch: Start Xvfb (Virtual Screen) then the Python AppCMD ["sh", "-c", "Xvfb :99 -ac -screen 0 1280x720x24 & python app.py"]
Dockerfile+19-31