# Step 10: the CoverageCheck demo as one image, for a Hugging Face Docker Space. # Stage 1 builds the React frontend (Node is needed only at build time); stage 2 is the # Python app, which serves web/dist and /api on one port. Hugging Face builds this from # the files coveragecheck.deploy.space uploads (incl. data/index, which git ignores). FROM node:26-slim AS web WORKDIR /web # the lock file first: this layer is reused while the dependencies do not change COPY web/package.json web/package-lock.json ./ RUN npm ci COPY web/ ./ RUN npm run build FROM python:3.12-slim COPY --from=ghcr.io/astral-sh/uv:0.13.9 /uv /bin/uv # Hugging Face runs the container as uid 1000: that user owns the app and its models RUN useradd -m -u 1000 user && mkdir /app && chown user:user /app USER user WORKDIR /app ENV UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy \ UV_NO_CACHE=1 \ UV_PYTHON_DOWNLOADS=never \ COVERAGECHECK_ROOT=/app \ FASTEMBED_CACHE_PATH=/app/models # the dependencies (no Docling, no test tools), then the project itself COPY --chown=user .python-version pyproject.toml uv.lock README.md ./ RUN uv sync --frozen --no-group ingest --no-group dev --no-install-project COPY --chown=user src ./src RUN uv sync --frozen --no-group ingest --no-group dev # both fastembed models, downloaded now: no visitor waits for a download RUN uv run --no-sync python -m coveragecheck.deploy.bake COPY --chown=user data/index ./data/index COPY --chown=user --from=web /web/dist ./web/dist # offline at run time: a model missing from the image fails at boot, never downloads ENV PATH=/app/.venv/bin:$PATH \ HF_HUB_OFFLINE=1 \ HOST=0.0.0.0 \ PORT=7860 EXPOSE 7860 CMD ["python", "-m", "coveragecheck.web.api"]