# Use the official Playwright image which has all system deps pre-installed FROM ://microsoft.com # Set up a non-root user for Hugging Face compatibility RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Playwright browsers are already in the image, # but we ensure the Python links are ready RUN python3 -m playwright install chromium # Copy application code COPY --chown=user . . # Run with Xvfb to provide a display for the browser CMD ["xvfb-run", "-a", "python3", "app.py"]