# Image fuer die Immo-Bot Web-App (Flask).
# Chrome selbst laeuft NICHT hier, sondern im selenium-Container / -Sidecar
# (SELENIUM_REMOTE_URL, siehe docker-compose.yml bzw. das Helm-Chart).
#
# Single-Process bewusst: die App haelt In-Memory-State + SSE-Streams und startet
# eigene Threads fuer parallel_workers -> KEIN gunicorn-Multi-Worker.

FROM python:3.12-slim

WORKDIR /app

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

COPY . .

EXPOSE 5000

# Container-/Compose-Healthcheck gegen den leichten /healthz-Endpoint.
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=5 \
  CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:5000/healthz',timeout=2).status==200 else 1)"

CMD ["python", "app.py"]
