# Playwright's official Python image ships Chromium + Firefox + WebKit
# pre-installed with all the system libs they need. patchright reuses
# Playwright's deps but ships its own (de-fingerprinted) Chromium build.
FROM mcr.microsoft.com/playwright/python:v1.49.0-jammy

ENV PYTHONUNBUFFERED=1 \
    HOME=/tmp

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# patchright fork — minimum stealth so route-explorer's SPA executes
# normally. We deliberately *don't* use anti-detect tools beyond that;
# the strategy is to drive the page like a real user (fill form, click
# search) which makes the SPA trigger Turnstile organically, then let
# Cloudflare auto-pass our session.
RUN patchright install chromium --with-deps

COPY app.py .

EXPOSE 8090

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8090", "--proxy-headers"]
