Spaces:
Runtime error
Runtime error
| # Use the official Playwright image | |
| FROM mcr.microsoft.com/playwright/python:v1.41.0-jammy | |
| # Set working directory | |
| WORKDIR /app | |
| # 1. Install Xvfb (The Virtual Monitor) and other dependencies | |
| RUN apt-get update && apt-get install -y xvfb libx11-xcb1 libxcb-dri3-0 libxcomposite1 libxcursor1 libxdamage1 libxi6 libxtst6 libnss3 libcups2 libxss1 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install Chromium | |
| RUN playwright install chromium | |
| # Copy all project files | |
| COPY . . | |
| # Grant permissions | |
| RUN chmod -R 777 /app | |
| # Expose the port | |
| EXPOSE 7860 | |
| # 2. START COMMAND (Run Python inside the Virtual Monitor) | |
| # We use "xvfb-run" to create a fake screen before launching the app | |
| CMD ["xvfb-run", "--auto-servernum", "--server-args='-screen 0 1280x1024x24'", "python", "app.py"] |