FROM python:3.12-slim # Install system dependencies needed for Pillow, fontconfig, and ffmpeg RUN apt-get update && apt-get install -y \ ffmpeg \ libgl1 \ libglib2.0-0 \ libgomp1 \ fontconfig \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies first (layer caching) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . COPY reddit_template.png . # Copy fonts directory (must exist in repo — add .gitkeep if no fonts yet) COPY fonts/ ./fonts/ # Hugging Face Spaces requires port 7860 EXPOSE 7860 # Run with uvicorn on the required HF port CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]