Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y \ | |
| ca-certificates \ | |
| fonts-liberation \ | |
| libasound2 \ | |
| libatk1.0-0 \ | |
| libatk-bridge2.0-0 \ | |
| libcups2 \ | |
| libdbus-1-3 \ | |
| libexpat1 \ | |
| libgtk-3-0 \ | |
| libnss3 \ | |
| libwayland-client0 \ | |
| libxcomposite1 \ | |
| libxrandr2 \ | |
| libxss1 \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy and install Python dependencies first (better Docker layer caching) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Install Playwright Chromium WITH all OS-level dependencies. | |
| # --with-deps automatically installs libgbm1, libpango, libcairo, etc. | |
| # that chromium_headless_shell needs — the manual apt-get list was incomplete. | |
| RUN python -m playwright install --with-deps chromium | |
| # Expose port (HF Spaces expects 7860) | |
| EXPOSE 7860 | |
| # Run with uvicorn — single worker (Playwright can't survive process forking) | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |