FROM python:3.12-slim

WORKDIR /app

# git mode clones REC_DATA_GIT_URL at boot (SSH remotes need openssh-client).
RUN apt-get update \
    && apt-get install -y --no-install-recommends git openssh-client ca-certificates \
    && rm -rf /var/lib/apt/lists/*

COPY pyproject.toml ./
COPY app ./app
RUN pip install --no-cache-dir .

EXPOSE 8000

# PORT lets hosts (Cloud Run, Fly, etc.) inject the listen port.
ENV PORT=8000
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT}"]
