FROM python:3.13-slim

# curl_cffi needs these at runtime on slim images
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY dist/caddie-mcp-*.whl /tmp/
RUN pip install --no-cache-dir /tmp/caddie-mcp-*.whl && rm /tmp/*.whl

# All state (user registry, per-user DBs, Garmin tokens) lives in /data —
# mount a volume there and back it up; it contains account credentials.
ENV CADDIEMCP_HOME=/data
VOLUME /data

EXPOSE 8724
# Multi-user bearer-auth server. Manage users with:
#   docker exec -it <container> caddie-mcp user add <name>
#   docker exec -it <container> caddie-mcp user login <name>
CMD ["caddie-mcp", "serve-http", "--host", "0.0.0.0", "--port", "8724"]
