feat(ecosystem): adopt hub-core dependency and CI pin gate (CORE-WP-0009)
Some checks failed
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / pytest-smoke (push) Failing after 2s
Build and Publish Container Image / build-and-push (push) Failing after 1m51s

Import slugify_or_default from hub-core, add contract tests, vendor hub-core in
Docker/Forgejo CI, document metadata isolation and pagination deferral, and
align INTENT/SCOPE with three-repo stack.
This commit is contained in:
tegwick 2026-07-11 01:26:53 +02:00
parent 564830c4aa
commit 0709262ffd
21 changed files with 1082 additions and 55 deletions

View file

@ -1,31 +1,44 @@
# Stage 1: install production dependencies into an isolated virtualenv.
FROM python:3.12-slim AS builder
FROM python:3.12-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/app/.venv/bin:${PATH}" \
PYTHONPATH="/app/src" \
CORE_HUB_ENV="staging" \
CORE_HUB_AUTO_CREATE_TABLES="0"
RUN pip install uv --no-cache-dir
WORKDIR /app
COPY pyproject.toml uv.lock README.md ./
COPY src/ ./src/
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir uv
COPY pyproject.toml ./
# Bump DEPS_LOCK_ID when dependency wiring changes (busts DinD layer cache).
ARG DEPS_LOCK_ID=2
RUN echo "deps-lock=${DEPS_LOCK_ID}" \
&& python -c "import tomllib,sys; from pathlib import Path; project=tomllib.load(open('pyproject.toml','rb'))['project']; deps=[d for d in (project.get('dependencies') or []) if d != 'hub-core']; \
sys.exit('no installable dependencies') if not deps else None; Path('/app/requirements.txt').write_text('\\n'.join(deps)+'\\n'); print(f'wrote {len(deps)} requirements')" \
&& test -s /app/requirements.txt \
&& uv venv /app/.venv \
&& uv pip install --python /app/.venv/bin/python --no-cache -r /app/requirements.txt
COPY --from=hub_core_src pyproject.toml /tmp/hub-core/pyproject.toml
COPY --from=hub_core_src hub_core/ /tmp/hub-core/hub_core/
RUN uv pip install --python /app/.venv/bin/python --no-cache /tmp/hub-core \
&& /app/.venv/bin/python -c "import hub_core; print(hub_core.__version__)"
COPY alembic.ini ./
COPY migrations/ ./migrations/
COPY scripts/ ./scripts/
RUN uv sync --no-dev --frozen
# Stage 2: runtime image for API and migration job commands.
FROM python:3.12-slim AS runtime
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/src /app/src
COPY --from=builder /app/alembic.ini /app/alembic.ini
COPY --from=builder /app/migrations /app/migrations
COPY --from=builder /app/scripts /app/scripts
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONPATH="/app/src"
ENV CORE_HUB_ENV="staging"
ENV CORE_HUB_AUTO_CREATE_TABLES="0"
COPY src/ ./src/
EXPOSE 8010
CMD ["uvicorn", "core_hub.app:app", "--host", "0.0.0.0", "--port", "8010"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8010/healthz', timeout=3).read()"
CMD ["uvicorn", "core_hub.app:app", "--host", "0.0.0.0", "--port", "8010"]