# Dockerfile FROM python:3.9-slim ENV DEBIAN_FRONTEND=noninteractive ENV CHROME_BIN=/usr/bin/google-chrome-stable WORKDIR /app # Install system packages needed for Chrome, Xvfb and general runtime. RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ wget \ gnupg \ unzip \ xvfb \ x11-utils \ fonts-liberation \ libnss3 \ libxss1 \ libasound2 \ libatk1.0-0 \ libatk-bridge2.0-0 \ libcups2 \ libx11-xcb1 \ libxcomposite1 \ libxdamage1 \ libxrandr2 \ libgbm1 \ xdg-utils \ libxrender1 \ libxext6 \ libxshmfence1 \ libglib2.0-0 \ libdbus-1-3 \ libdrm2 \ && rm -rf /var/lib/apt/lists/* # Add Google's signing key and install google-chrome-stable RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \ | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \ && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \ > /etc/apt/sources.list.d/google-chrome.list \ && apt-get update \ && apt-get install -y --no-install-recommends google-chrome-stable \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install python packages COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r /app/requirements.txt # Install Playwright browsers (chromium) with dependencies RUN python -m playwright install --with-deps chromium # Copy application code COPY . /app # Expose port EXPOSE 7860 # Run the app (runs as root for simplicity) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]