FROM python:3.12-slim # Prevent Python from buffering stdout/stderr ENV PYTHONUNBUFFERED=1 # Install system dependencies required by Playwright RUN apt-get update && apt-get install -y \ curl \ wget \ git \ libnss3 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libdrm2 \ libxkbcommon0 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ libgbm1 \ libasound2 \ libpangocairo-1.0-0 \ libpango-1.0-0 \ libcairo2 \ libx11-6 \ libxcb1 \ libxext6 \ libx11-xcb1 \ libxcursor1 \ libxi6 \ libxtst6 \ fonts-liberation \ ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Install Playwright browser RUN playwright install chromium # Copy project COPY . . EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]