FROM mcr.microsoft.com/playwright/python:v1.47.0-jammy

LABEL net.unraid.docker.webui="http://[IP]:[PORT:5000]/"
LABEL maintainer="MassPrice Scheduler"

WORKDIR /app

# socat proxies the login-session debug port: Chromium's remote-debugging
# port binds to 127.0.0.1 only, regardless of --remote-debugging-address
# (deliberate Chromium security hardening, confirmed by testing) — a
# loopback-only listener is unreachable through Docker's port mapping,
# so socat re-exposes it on all interfaces. See automation.py.
RUN apt-get update -qq && apt-get install -y -qq socat && rm -rf /var/lib/apt/lists/*

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

COPY . .

EXPOSE 5000

CMD ["gunicorn", "--config=gunicorn.conf.py", "app:app"]
