# agentfold routing gateway — container image (G4).
#
#   docker build -t agentfold-gateway .
#   docker run -p 8000:8000 \
#     -e ANTHROPIC_API_KEY=sk-ant-... -e OPENAI_API_KEY=sk-... \
#     -e AGENTFOLD_MAX_USD=100 \
#     -e GATEWAY_BUDGET_DB=/data/budget.db \
#     -e GATEWAY_EVENTS_LOG=/data/events.jsonl -e GATEWAY_EVENTS_MAX_BYTES=50000000 \
#     -v "$PWD/mygateway.json:/config/gateway.json:ro" -v agentfold-data:/data \
#     agentfold-gateway
#
# See docs/gateway_deploy.md for the config format, key hashing, TLS, and scaling.
FROM python:3.12-slim

WORKDIR /app
COPY . /app

# Install the package with the gateway server + both provider SDKs.
RUN pip install --no-cache-dir ".[gateway,anthropic,openai]"

# Bind to all interfaces inside the container; map the port on the host.
ENV GATEWAY_HOST=0.0.0.0 \
    GATEWAY_PORT=8000 \
    GATEWAY_EVENTS_LOG=/data/events.jsonl
EXPOSE 8000
VOLUME ["/data"]

# Config is mounted read-only at /config/gateway.json; provider keys come from env.
ENTRYPOINT ["python", "-m", "agentfold.gateway"]
CMD ["/config/gateway.json"]
