# dmstfy-voice-core runtime — always-on voice agent container.
# BUILD CONTEXT = REPO ROOT (not this directory):
#   docker build -f modules/dmstfy-voice-core/runtime/Dockerfile .
# The [server] extra (fastapi/uvicorn — required by the CMD below) pulls the
# [platform] suite, whose [tool.uv.sources] entries point at
# ../../../packages/platform-* (the repo-root platform layer) — from /app that
# resolves to /packages, so the platform packages are copied there for the
# editable installs (and mirrored into the final stage at the same path).
FROM python:3.11-slim AS build
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY packages/platform-contracts /packages/platform-contracts
COPY packages/platform-state /packages/platform-state
COPY packages/platform-observability /packages/platform-observability
COPY packages/platform-profiles /packages/platform-profiles
COPY modules/dmstfy-voice-core/runtime/pyproject.toml modules/dmstfy-voice-core/runtime/uv.lock ./
RUN uv sync --frozen --no-install-project --no-dev --extra server
COPY modules/dmstfy-voice-core/runtime/src ./src
RUN uv sync --frozen --no-dev --extra server

FROM python:3.11-slim
WORKDIR /app
# platform-* are installed editable from /packages — keep the same paths
COPY --from=build /packages /packages
COPY --from=build /app/.venv /app/.venv
COPY --from=build /app/src /app/src
ENV PATH="/app/.venv/bin:$PATH" PYTHONUNBUFFERED=1
EXPOSE 8090
CMD ["uvicorn", "demystify_voice.api.main:app", "--host", "0.0.0.0", "--port", "8090"]
