FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PIP_NO_CACHE_DIR=1

# curl: for smoke.sh + /health probes.
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY pyproject.toml ./
COPY src ./src
COPY scripts ./scripts
COPY sources ./sources

RUN pip install --upgrade pip && pip install .

# sources/ is bind-mountable so an operator can drop files (esp. bnatschg.txt)
# without a rebuild.
VOLUME ["/app/sources"]

EXPOSE 8080

CMD ["uvicorn", "artenschutz_router.main:app", "--host", "0.0.0.0", "--port", "8080"]
