| # Base image — Python 3.10 slim | |
| FROM python:3.10-slim | |
| # Set working directory inside container | |
| WORKDIR /app | |
| # Install system dependencies with retry fix | |
| RUN apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* && \ | |
| apt-get update --fix-missing && \ | |
| apt-get install -y --no-install-recommends \ | |
| git \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxrender1 \ | |
| libxext6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first (for faster rebuilds) | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy all project files into the container | |
| COPY . . | |
| # Expose the port Hugging Face Spaces expects | |
| EXPOSE 7860 | |
| # Run the app | |
| CMD ["python", "app.py"] |