# NOTE: this image depends on `triagekit-mcp-core` resolving from PyPI (the build context is
# this package directory only - it can't see ../core). Per the core-first release order in
# CONTRIBUTING.md, this image cannot build successfully until triagekit-mcp-core has been
# published. Not yet verified locally (no Docker available in the dev environment this was
# built in) - verify a real `docker build .` here before relying on the docker.yml workflow.

FROM python:3.12-slim AS build

WORKDIR /app
COPY . .
RUN pip install --no-cache-dir build && python -m build --wheel

FROM python:3.12-slim

RUN useradd --create-home --shell /bin/bash mcp
USER mcp
WORKDIR /home/mcp

COPY --from=build /app/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm /tmp/*.whl

ENTRYPOINT ["triagekit-mcp-flaky-test-detective"]
