# Use Python 3.9 or 3.10 FROM python:3.10-slim # Install system dependencies for Playwright RUN apt-get update && apt-get install -y \ wget \ gnupg \ libnss3 \ libnspr4 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libasound2 \ libpangocairo-1.0-0 \ libxshmfence1 \ libx11-xcb1 \ && rm -rf /var/lib/apt/lists/* # Set up work directory WORKDIR /app # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Install Playwright browsers (Chromium) RUN playwright install chromium RUN playwright install-deps chromium # Copy application files COPY . . # Exposure port (Hugging Face default is 7860) EXPOSE 7860 # Run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]