# Use official Python slim image FROM python:3.11-slim # Set working directory WORKDIR /app # Install system dependencies including Playwright requirements RUN apt-get update && apt-get install -y \ curl \ gnupg \ ca-certificates \ libnss3 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libx11-xcb1 \ libxcomposite1 \ libxdamage1 \ libxrandr2 \ libgbm1 \ libpango-1.0-0 \ libpangocairo-1.0-0 \ libasound2 \ fonts-liberation \ libglib2.0-0 \ libdrm2 \ libxfixes3 \ libxkbcommon0 \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Set Playwright browsers to a writable path ENV PLAYWRIGHT_BROWSERS_PATH=/tmp/playwright-browsers # Install Playwright browsers RUN playwright install chromium # Copy app files COPY . . # Expose port EXPOSE 7860 # Run FastAPI CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]