# The deployed service: the MCP surface OKX.AI lists, with the worker running
# alongside it.
FROM python:3.12-slim

# uv gives the same resolution here as on a developer machine, so a build that
# passes locally cannot resolve differently in the image.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app

# Dependencies before source, so a code change does not re-resolve the world.
# `--extra server` because the base install is the CLI only — see pyproject.
COPY pyproject.toml uv.lock README.md ./
RUN uv sync --frozen --no-dev --extra server --no-install-project

COPY src ./src
RUN uv sync --frozen --no-dev --extra server

ENV PORT=8000
EXPOSE 8000

# Delivered assets live here, and production must mount a volume at this path:
# a container restart otherwise loses every model inside its 72-hour retention
# window, and a caller holding a `model_url` gets a 404 for something they paid
# for.
#
# Declared in the platform rather than here. Railway rejects a `VOLUME`
# instruction outright — "use Railway Volumes" — because it owns the mount, and
# a Dockerfile that declares one fails the build before it starts.
RUN mkdir -p /app/assets

CMD ["sh", "-c", "uv run python -m ondaru.mcp ${PORT}"]
