Spaces:
Paused
Paused
| FROM python:3.11-slim | |
| # PHASE 1: Root Execution (System Dependencies) | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| # Install Python packages | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Execute official Playwright dependency installer | |
| RUN playwright install-deps | |
| # PHASE 2: User Execution (Hugging Face Strict Requirement) | |
| RUN useradd -m -u 1000 aghrba | |
| RUN chown -R aghrba:aghrba /app | |
| USER aghrba | |
| ENV HOME=/home/aghrba \ | |
| PATH=/home/aghrba/.local/bin:$PATH | |
| # Lock the binary inside the image to prevent runtime concurrency crashes | |
| RUN python -m camoufox fetch | |
| # Inject Aghrba API logic | |
| COPY --chown=aghrba app.py . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |