# dmstfy-extract ingest/extraction worker image.
# BUILD CONTEXT = REPO ROOT (not the module):
#   docker build -f modules/dmstfy-extract/worker/Dockerfile .
# worker/pyproject.toml [tool.uv.sources] points at ../../../packages/platform-*
# (the repo-root platform layer). We mirror the repo layout inside the image —
# module at /app/modules/dmstfy-extract/worker, platform packages at
# /app/packages — so those relative source paths resolve exactly as in the repo
# (uv refuses to normalize a path that escapes the workspace root, which is why
# the module cannot sit shallower than its real repo depth).
FROM python:3.11-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app/modules/dmstfy-extract/worker
COPY packages/platform-contracts /app/packages/platform-contracts
COPY packages/platform-observability /app/packages/platform-observability
COPY packages/platform-profiles /app/packages/platform-profiles
COPY modules/dmstfy-extract/worker/pyproject.toml modules/dmstfy-extract/worker/uv.lock ./
COPY modules/dmstfy-extract/worker/src src
COPY modules/dmstfy-extract/schemas /app/modules/dmstfy-extract/schemas
COPY modules/dmstfy-extract/fixtures /app/modules/dmstfy-extract/fixtures
RUN uv sync --frozen --no-dev --extra pg --extra ocr
ENV PATH="/app/modules/dmstfy-extract/worker/.venv/bin:$PATH"
CMD ["python", "-m", "demystify_extract_worker.serve"]
