Skip to content

feat(dist): OCI container with multi-arch + healthcheck + compose (#1236) - #1319

Merged
Sinity merged 1 commit into
masterfrom
feature/dist/oci-container-1236
May 18, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/dist/oci-container-1236

Conversation

@Sinity

@Sinity Sinity commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Daemon-first OCI image for polylogued with a healthcheck against the daemon HTTP API, a declared volume contract for archive + config, multi-arch publication (linux/amd64 + linux/arm64), a distroless variant, and a sample docker-compose.yaml. Image lands on ghcr.io/sinity/polylogue via a dedicated container.yml workflow.

Closes #1236
Ref #953

Problem

The only daemon distribution path was a one-stage Containerfile built and pushed inline from release.yml. That job:

  • Built single-arch only (linux/amd64).
  • Had no HEALTHCHECK and no declared VOLUME contract — operators had to guess the data + config layout.
  • Defaulted to polylogue --help instead of starting the daemon, so the image did nothing useful when run without overrides.
  • Used UID 1000, not the AC-specified 10001.
  • Did not publish a distroless variant.
  • Was coupled to the wheel/sdist release pipeline, which meant container changes could not iterate independently.

Solution

  • Containerfile rewritten:
    • Daemon-first ENTRYPOINT (tini) + CMD (polylogued run --enable-api --api-host 0.0.0.0 --api-port 8766). CLI (polylogue, polylogue-mcp) remains on PATH for docker exec debug per the issue's decision.
    • Non-root user polylogue at UID/GID 10001 (build-arg overridable).
    • ENV POLYLOGUE_ARCHIVE_ROOT=/data/archive, ENV POLYLOGUE_CONFIG_DIR=/etc/polylogue, matching VOLUME ["/data/archive", "/etc/polylogue"].
    • EXPOSE 8766; HEALTHCHECK calls http://127.0.0.1:8766/api/health (route confirmed in polylogue/daemon/http.py:626-629, default --api-port 8766 from daemon/cli.py:799).
    • OCI labels (title, description, source, licenses, vendor); the workflow overrides these from docker/metadata-action.
    • Distroless stage (gcr.io/distroless/python3-debian12:nonroot) reusing the runtime stage's installed site-packages so both variants stay in lockstep.
  • .dockerignore added: trims build context (no .git, .cache, .venv, tests, docs except README).
  • .github/workflows/container.yml: dedicated workflow with a [runtime, distroless] matrix. Builds both for linux/amd64 + linux/arm64 via docker/setup-qemu-action + docker/setup-buildx-action. Publishes to ghcr.io/sinity/polylogue on master and on v*.*.* tags with semver + master-<sha> tagging via docker/metadata-action (-distroless suffix on the distroless variant). PR builds smoke amd64-only and do not push. Provenance + SBOM attestations enabled.
  • release.yml: dropped the inline publish-container job (now owned by container.yml); updated the header comment.
  • docs/docker-compose.yaml: full sample exercising the volume contract, healthcheck, named volumes, user: "10001:10001", read_only: true, cap_drop: [ALL], no-new-privileges:true. Includes commented-out lines for read-only bind-mounts of provider export roots.
  • docs/installation.md: variant matrix (slim vs distroless), volume contract, quick-start, compose pointer, distroless notes (no curl → orchestrator-level probes), backup expectations.

Alternatives rejected:

  • Keeping the inline publish-container step in release.yml: rejected — keeps container iteration coupled to wheel/sdist gates and forces every container change to walk the full release matrix.
  • Single workflow run with separate jobs per variant + per platform: rejected in favour of buildx's native multi-arch single-job build to share cache between variants and platforms.
  • Putting docker-compose.yaml at repo root: kept under docs/ to avoid implying it is the project's canonical deployment manifest.

Verification

$ nix develop -c devtools verify --quick
  ruff format ... ok
  ruff check ... ok
  mypy ... ok
  render-all ... ok
  verify-topology ... ok
  verify-layering ... ok
  verify-file-budgets ... ok
  verify-test-ownership ... ok
  verify-closure-matrix ... ok
  verify-schema-roundtrip ... ok
  verify-cross-cuts ... ok
  verify-suppressions ... ok
  verify-manifests ... ok
  verify-ci-workflows ... ok
  verify-witness-lifecycle ... ok
  verify-witness-coverage ... ok
  verify-lane-assertions ... ok
  verify-test-infra-currency ... ok
  verification-impact check ... ok
  exit_code: 0

verify-ci-workflows covers the new .github/workflows/container.yml. Docker is not available on the build host, so the image itself is exercised by the new container.yml workflow (PR builds smoke --version / --help on amd64; tag/master builds publish multi-arch).

Follow-ups

  • The distroless stage omits HEALTHCHECK (no curl in distroless); compose/Kubernetes probes against /api/health are documented in docs/installation.md. A pure-Python healthcheck binary baked into the image would let us restore HEALTHCHECK on the distroless variant — out of scope here.
  • Image-size budget (the issue suggests <200MB) is left to the CI build to measure; if the distroless variant misses the budget we can shed extras in a follow-up.

Daemon-first OCI image with healthcheck, declared volume contract, and
multi-arch publication. Adds a distroless variant and a sample compose
file that documents the operator surface.

- Containerfile: daemon-first ENTRYPOINT/CMD (polylogued run --enable-api),
  UID/GID 10001 (build-arg overridable), POLYLOGUE_ARCHIVE_ROOT=/data/archive
  and POLYLOGUE_CONFIG_DIR=/etc/polylogue with matching VOLUME declarations,
  EXPOSE 8766, HEALTHCHECK via curl to /api/health, OCI image labels.
- Distroless stage (gcr.io/distroless/python3-debian12:nonroot) for
  security-conscious deployments. Reuses the runtime stage's installed
  site-packages so both variants stay in lockstep.
- .dockerignore: lean build context (no .git, .cache, .venv, tests, docs).
- .github/workflows/container.yml: dedicated workflow building both
  variants for linux/amd64 + linux/arm64 via buildx + QEMU, pushing to
  ghcr.io/sinity/polylogue on master and on v*.*.* tags with semver +
  master-<sha> tagging via docker/metadata-action. PR builds smoke
  amd64 only and do not push.
- release.yml: drop the duplicate publish-container job (now owned by
  container.yml).
- docs/docker-compose.yaml: full sample with healthcheck, named volumes,
  user 10001, read_only root, cap_drop ALL, no-new-privileges.
- docs/installation.md: variant matrix, volume contract, compose pointer,
  distroless notes, backup expectations.

Closes #1236

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@Sinity
Sinity merged commit 7cf4a78 into master May 18, 2026
1 of 3 checks passed
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 52 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 597d2e0a-fefb-4080-a2f9-f92f9fb16687

📥 Commits

Reviewing files that changed from the base of the PR and between ef6a09a and 7d19acc.

📒 Files selected for processing (6)
  • .dockerignore
  • .github/workflows/container.yml
  • .github/workflows/release.yml
  • Containerfile
  • docs/docker-compose.yaml
  • docs/installation.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dist/oci-container-1236

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sinity
Sinity deleted the feature/dist/oci-container-1236 branch May 18, 2026 15:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d19acc0d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Containerfile Resolved
Comment thread Containerfile Resolved
Comment thread .github/workflows/container.yml Resolved
Sinity added a commit that referenced this pull request May 19, 2026
## Summary

Gate `provenance` and `sbom` on `steps.decide.outputs.push == 'true'` in
`.github/workflows/container.yml` so attestations are emitted only on
push paths (master, tag, opt-in workflow_dispatch) where the image is
published to GHCR. PR smoke builds, which set `load: true` to import
into the local docker daemon, no longer request attestations and
therefore no longer produce a manifest list that the classic docker
image store cannot import.

## Problem

The `Container` workflow has been failing on every push to `master`
since #1319 merged (2026-05-18), and on every PR that triggers it
(dependabot #1357 / #1358 / #1359, etc.). Both matrix jobs (`build
(runtime)` and `build (distroless)`) fail with:

```
ERROR: failed to build: docker exporter does not currently support exporting manifest lists
```

Root cause (see #1373): `docker/build-push-action@v6` is configured with
`provenance: true` + `sbom: true` + `load: ${{ steps.decide.outputs.push
!= 'true' }}`. Buildx emits attestations as a manifest list even on a
single-platform build, and the classic docker image store cannot import
manifest lists via `--load`. The combination has never been compatible
(docker/buildx#1533, docker/build-push-action#820). The previous inlined
publish-container job in `release.yml` pushed directly to ghcr.io and
never hit `--load`, which is why the latent conflict only surfaced after
#1319 introduced PR smoke builds.

## Solution

`.github/workflows/container.yml`:

```yaml
provenance: ${{ steps.decide.outputs.push == 'true' }}
sbom:       ${{ steps.decide.outputs.push == 'true' }}
```

This is option 1 from the issue's recommended fixes — the minimal
coherent change.

- Push paths (master, tag, `workflow_dispatch` with `push=true`) still
produce signed provenance + SBOM attestations on the published image,
exactly as before.
- PR / `workflow_dispatch` smoke paths skip attestations. The
single-platform image loads cleanly into the local docker daemon and the
existing `docker run --rm --entrypoint ... --version` smoke test runs
unchanged.
- No code paths touched; no other workflows touched; behavior on
published images is preserved.

Alternatives rejected: containerd image store (needs runner-level daemon
config, infeasible on hosted runners); OCI tarball + skopeo (more moving
parts than the symptom warrants).

## Verification

- Reviewed the failing workflow definition and confirmed the only call
sites for `provenance`/`sbom`/`load` are the four lines edited in this
PR.
- Confirmed `steps.decide` already gates the push/load decision
symmetrically (`push=false`/`load=true` on `pull_request`,
`push=true`/no `--load` on master/tag), so reusing that boolean for
attestations preserves the published-artifact surface.
- The actual smoke is the Container workflow run on this PR;
expectation: both `build (runtime)` and `build (distroless)` go green,
and master/tag pushes continue to publish provenance- and SBOM-attested
images.

Closes #1373
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 50.F089 / P1: fixed-already at the checked revision: The image metadata rules now include an explicit pull-request tag at .github/workflows/container.yml:151. Pull-request smoke builds therefore receive a PR image reference instead of relying only on semver and default-branch tag rules.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(dist): OCI container image for polylogued with healthcheck and volume contract

1 participant