Spaces:
Sleeping
Sleeping
| # 1. Use the specific Python version you requested | |
| FROM python:3.11.9-slim | |
| # 2. Install basic system tools | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| gnupg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 3. Install Playwright python library temporarily as root | |
| # We need this so we can run the 'install-deps' command next | |
| RUN pip install playwright | |
| # 4. CRITICAL STEP: Install the missing system browsers libraries | |
| # This downloads all the linux dependencies (libglib, libnss, etc.) | |
| # that caused your previous crash. | |
| RUN playwright install-deps | |
| # 5. Set up the Hugging Face user (Security Requirement) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 6. Set working directory | |
| WORKDIR $HOME/app | |
| # 7. Copy your application files | |
| COPY --chown=user . $HOME/app | |
| # 8. Install your project dependencies (gradio, crawl4ai, etc.) | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 9. Install the actual Chromium Browser binary | |
| RUN playwright install chromium | |
| # 10. Start the App | |
| CMD ["python", "app.py"] |