Spaces:
Runtime error
Runtime error
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies (fixed for Debian Trixie) | |
| RUN apt-get update && apt-get install -y \ | |
| libglx-mesa0 \ | |
| libgl1-mesa-dri \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip | |
| RUN pip install --upgrade pip | |
| # Copy requirements first for better layer caching | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY . . | |
| # Create gunicorn configuration file | |
| RUN echo 'import multiprocessing\n\ | |
| \n\ | |
| bind = "0.0.0.0:7860"\n\ | |
| workers = 2 # HF Spaces provide 2 vCPUs\n\ | |
| worker_class = "uvicorn.workers.UvicornWorker"\n\ | |
| timeout = 120\n\ | |
| keepalive = 5\n\ | |
| max_requests = 1000\n\ | |
| max_requests_jitter = 50\n\ | |
| graceful_timeout = 30\n\ | |
| ' > /app/gunicorn_conf.py | |
| ENV HF_HOME=/data | |
| RUN mkdir -p /data | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "-c", "gunicorn_conf.py", "app:app"] |