FROM python:3.11-slim

WORKDIR /app

# tzdata is required for the TZ env var to take effect (python:slim
# omits the timezone database).  Without it, datetime.now() / logging
# / matplotlib all stay in UTC regardless of TZ.  Default zone gets
# set further down via ENV; users override per-deployment via the
# `TZ` env var in docker-compose.
RUN apt-get update && \
    apt-get install -y --no-install-recommends curl tzdata && \
    rm -rf /var/lib/apt/lists/*

# Default display timezone — applied to server logs, datetime.now(),
# matplotlib rendered timestamps, and any naïve-vs-aware datetime
# conversions in the PDF renderer.  Override via TZ env var in
# docker-compose; storage in the DB is always UTC regardless.
ENV TZ=America/New_York

COPY pyproject.toml requirements.txt ./
COPY minimateplus ./minimateplus
COPY micromate    ./micromate
COPY sfm          ./sfm
COPY bridges      ./bridges
COPY scripts      ./scripts

RUN pip install --no-cache-dir -e .

EXPOSE 8200

CMD ["python", "-m", "uvicorn", "sfm.server:app", "--host", "0.0.0.0", "--port", "8200"]