Spaces:
Running
Running
| FROM python:3.10-slim | |
| # ββ 1. Install Python deps first (as root) so we can use playwright CLI ββ | |
| COPY requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| # ββ 2. Let Playwright install ALL required system libraries automatically ββ | |
| # This is the official way β it knows exactly which libs are needed | |
| # and avoids the manual guesswork that caused missing libXfixes etc. | |
| RUN playwright install-deps chromium | |
| # ββ 3. Create the mandatory HF user (UID 1000) ββ | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONUNBUFFERED=1 | |
| WORKDIR $HOME/app | |
| # ββ 4. Install the Chromium browser binary as the non-root user ββ | |
| RUN playwright install chromium | |
| # ββ 5. Copy the application code ββ | |
| COPY --chown=user app.py . | |
| # ββ 6. Expose the Streamlit port and launch ββ | |
| EXPOSE 7860 | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"] | |