# Use Python 3.11 slim image FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies (updated for Debian Trixie/newer) RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ libgomp1 \ libgthread-2.0-0 \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Create necessary directories RUN mkdir -p /data/uploads /data/uploads/videos /data/hf-cache # Expose port 7860 (required by Hugging Face Spaces) EXPOSE 7860 # Set environment variables ENV HF_SPACE=1 ENV HF_CACHE_DIR=/data/hf-cache ENV UPLOAD_DIR=/data/uploads ENV PYTHONUNBUFFERED=1 # Run the application CMD ["python", "app.py"]