From 0c97b733e7d22029e7a60928338093e66e68510e Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:24:12 -0500 Subject: [PATCH 1/5] feat: publish openab-sb container image to GHCR on v* tags Add a Dockerfile that packages the release's static openab-sb binary on debian:bookworm-slim with curl and ca-certificates, running as a non-root user, and an `image` job in release.yml that builds linux/amd64+arm64 and pushes ghcr.io/openabdev/openab-sb on v* tags. The job reuses the binaries from the `build` job and has packages:write only. Verification (see .agents/tasks/k8s-openab-sb/verification.md, outside repo): - ruby -ryaml load of .github/workflows/release.yml: exit 0, jobs build/publish/image - staging tar extraction on a fake tarball: exit 0, binary is 0755 - hadolint: not installed, not run - docker build: docker daemon down, not built - no cargo/rustc run locally --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ Dockerfile | 29 +++++++++++++++++++++ README.md | 17 ++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f96059b..c001cf5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -102,3 +102,52 @@ jobs: gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \ --title "openab-sb ${GITHUB_REF_NAME#v}" --generate-notes \ dist/openab-sb-*.tar.gz dist/SHA256SUMS + + image: + name: container image (ghcr.io) + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + pattern: linux-* + path: dist + - name: Stage static binaries by architecture + shell: bash + run: | + set -euo pipefail + ver="${GITHUB_REF_NAME#v}" + for asset in linux-amd64 linux-arm64; do + arch="${asset#linux-}" + mkdir -p image-bin/"$arch" + tar xzf dist/"$asset"/openab-sb-"$ver"-"$asset".tar.gz -C image-bin/"$arch" --strip-components=1 openab-sb-"$ver"-"$asset"/openab-sb + chmod 0755 image-bin/"$arch"/openab-sb + done + image-bin/amd64/openab-sb --version + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/openab-sb + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2499e86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# +# Runtime image for openab-sb. It does not compile Rust. The release job in +# .github/workflows/release.yml unpacks the static musl binaries it already +# builds into image-bin//openab-sb (amd64, arm64) and runs buildx with +# this file as the Dockerfile. +# +# The config is not baked in. Mount it at /etc/openab-sb/openab-sb.toml. It +# must set listen = "127.0.0.1:8796" and an audit_path under /var/lib/openab-sb. +# The switchboard binds loopback, so only processes in the same pod (the +# tailscale sidecar) can reach it. + +FROM debian:bookworm-slim + +ARG TARGETARCH + +RUN apt-get update \ + && apt-get install -y --no-install-recommends ca-certificates curl \ + && rm -rf /var/lib/apt/lists/* + +RUN groupadd --system openab-sb \ + && useradd --system --gid openab-sb --no-create-home --home-dir /var/lib/openab-sb --shell /usr/sbin/nologin openab-sb \ + && install -d -o openab-sb -g openab-sb -m 0750 /var/lib/openab-sb /etc/openab-sb + +COPY image-bin/${TARGETARCH}/openab-sb /usr/local/bin/openab-sb + +USER openab-sb +WORKDIR /var/lib/openab-sb + +ENTRYPOINT ["/usr/local/bin/openab-sb", "serve", "-c", "/etc/openab-sb/openab-sb.toml"] diff --git a/README.md b/README.md index 51425a6..9992239 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,23 @@ cp openab-sb.toml.example openab-sb.toml # paste the verifiers Adding a computer later is an operator action — generate a pair, add the verifier, `SIGHUP`. There is no self-registration. +### Container image + +Each `v*` tag publishes a multi-arch (amd64, arm64) image to GHCR: + +```bash +docker pull ghcr.io/openabdev/openab-sb:0.2.2 # also :0.2 +``` + +The image is `debian:bookworm-slim` with the release's static `openab-sb` binary, `curl` and +`ca-certificates`. It runs as a non-root user, and its entrypoint is +`openab-sb serve -c /etc/openab-sb/openab-sb.toml`. The config is not baked in: mount it at that +path. It must set `listen = "127.0.0.1:8796"` and an `audit_path` under `/var/lib/openab-sb`, +which the image creates and owns for the audit file. + +A pod can probe the switchboard with `curl -fsS http://127.0.0.1:8796/healthz` from inside the +container. Keep the listener on loopback, and put TLS in a sidecar such as `tailscale serve`. + The switchboard binds loopback and refuses anything else unless you set `allow_insecure_bind = true`. Put TLS in front of it: From ce786c14a5a7928c97b6fa5fa22dbe49e861f84d Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:28:08 -0500 Subject: [PATCH 2/5] fix: numeric image user, lint-clean Dockerfile, README probe timeout Address review CHANGES_REQUESTED (findings 1 and 2). - README: the healthz probe now reads `curl -fsS --max-time 2 ...`, matching the settled probe string. - Dockerfile: use a numeric user, UID/GID 10001, so kubelet runAsNonRoot can verify it. Suppress DL3008 inline (pinning bookworm apt versions breaks on security updates). - README: state the UID/GID in the container image section. Verification (macmini, the only host with docker; this machine has none): - Input: published v0.2.2 linux-amd64/arm64 tarballs, `shasum -a 256 -c` against SHA256SUMS: OK, exit 0. - hadolint before fix: DL3008 warning, DL3066 info, exit 1. After fix: no findings, exit 0. - `docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile .`: exit 0. One harmless useradd warning (UID > SYS_UID_MAX). - Smoke test of arm64 image: uid=10001, `openab-sb --version` = 0.2.2, `check -c` on the example config with generated verifiers: exit 0. - ruby -ryaml load of .github/workflows/release.yml: exit 0, jobs build/publish/image unchanged. - Not run: GHCR push (tag-only job), amd64 image run, p1. Record: .agents/tasks/k8s-openab-sb/verification.md (outside repo). --- Dockerfile | 11 +++++++---- README.md | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2499e86..b7444d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,22 +8,25 @@ # must set listen = "127.0.0.1:8796" and an audit_path under /var/lib/openab-sb. # The switchboard binds loopback, so only processes in the same pod (the # tailscale sidecar) can reach it. +# +# The user is numeric (10001) so that kubelet runAsNonRoot can verify it. FROM debian:bookworm-slim ARG TARGETARCH +# hadolint ignore=DL3008 RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates curl \ && rm -rf /var/lib/apt/lists/* -RUN groupadd --system openab-sb \ - && useradd --system --gid openab-sb --no-create-home --home-dir /var/lib/openab-sb --shell /usr/sbin/nologin openab-sb \ - && install -d -o openab-sb -g openab-sb -m 0750 /var/lib/openab-sb /etc/openab-sb +RUN groupadd --system --gid 10001 openab-sb \ + && useradd --system --uid 10001 --gid 10001 --no-create-home --home-dir /var/lib/openab-sb --shell /usr/sbin/nologin openab-sb \ + && install -d -o 10001 -g 10001 -m 0750 /var/lib/openab-sb /etc/openab-sb COPY image-bin/${TARGETARCH}/openab-sb /usr/local/bin/openab-sb -USER openab-sb +USER 10001:10001 WORKDIR /var/lib/openab-sb ENTRYPOINT ["/usr/local/bin/openab-sb", "serve", "-c", "/etc/openab-sb/openab-sb.toml"] diff --git a/README.md b/README.md index 9992239..29625df 100644 --- a/README.md +++ b/README.md @@ -262,12 +262,12 @@ docker pull ghcr.io/openabdev/openab-sb:0.2.2 # also :0.2 ``` The image is `debian:bookworm-slim` with the release's static `openab-sb` binary, `curl` and -`ca-certificates`. It runs as a non-root user, and its entrypoint is +`ca-certificates`. It runs as the non-root user `openab-sb` (UID and GID 10001), and its entrypoint is `openab-sb serve -c /etc/openab-sb/openab-sb.toml`. The config is not baked in: mount it at that path. It must set `listen = "127.0.0.1:8796"` and an `audit_path` under `/var/lib/openab-sb`, which the image creates and owns for the audit file. -A pod can probe the switchboard with `curl -fsS http://127.0.0.1:8796/healthz` from inside the +A pod can probe the switchboard with `curl -fsS --max-time 2 http://127.0.0.1:8796/healthz` from inside the container. Keep the listener on loopback, and put TLS in a sidecar such as `tailscale serve`. The switchboard binds loopback and refuses anything else unless you set From e993c477820c9e6d3026508ffdeabf6c455dba75 Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Thu, 12 Nov 2026 15:27:38 -0500 Subject: [PATCH 3/5] chore: retrigger PR review bot From 3e07597ec075084f92ded9cc4b509d4ed525cdac Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Thu, 12 Nov 2026 15:30:15 -0500 Subject: [PATCH 4/5] chore: retrigger PR review bot (20261112T203015Z) From 2743c61088c6b75167e627bc84bddd4d8953bd35 Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Thu, 12 Nov 2026 16:48:48 -0500 Subject: [PATCH 5/5] fix: address PR #22 review findings for the container image - F1: use port 8790 everywhere (Dockerfile comment, README), matching DEFAULT_LISTEN in src/config.rs. The probe stays curl -fsS --max-time 2 http://127.0.0.1:8790/healthz. - F2: image job now needs [build, publish], so an image is pushed only after the GitHub Release succeeds. - F3: run the arm64 binary under QEMU (docker run --platform linux/arm64) before the push. The amd64 --version check is kept. - F4: release notes and README say a new GHCR package is private by default and must be set to Public once before anonymous pull works. - F5: add .dockerignore (exclude *, re-include image-bin/** and Dockerfile). - F6: README documents that stable tags also move :latest. The metadata-action flavor is unchanged (default latest=auto). Checks run: - ruby -ryaml: YAML.load_file(".github/workflows/release.yml") exits 0. - grep 8796 in README.md, Dockerfile, openab-sb.toml.example, release.yml: no matches. - hadolint not installed locally; not run. - macmini (OrbStack docker, arm64 host): docker build of the Dockerfile with a staged fake image-bin/amd64 binary and this .dockerignore succeeded; the COPY resolved. The arm64 step command (docker run --rm --platform linux/arm64 -v ...:/tmp/openab-sb:ro debian:bookworm-slim /tmp/openab-sb --version) ran and printed output with exit 0. This used a fake binary, not the release artifact. --- .dockerignore | 3 +++ .github/workflows/release.yml | 11 +++++++++-- Dockerfile | 2 +- README.md | 14 ++++++++++---- 4 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2cf3fae --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!image-bin/** +!Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c001cf5..6f12929 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,13 +99,14 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + NOTE="Container image: ghcr.io/openabdev/openab-sb:${GITHUB_REF_NAME#v} is pushed after this release is created. A new GHCR package is private by default. Set it to Public once under Package settings before anonymous docker pull works. Stable tags also move :latest." gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \ - --title "openab-sb ${GITHUB_REF_NAME#v}" --generate-notes \ + --title "openab-sb ${GITHUB_REF_NAME#v}" --generate-notes --notes "$NOTE" \ dist/openab-sb-*.tar.gz dist/SHA256SUMS image: name: container image (ghcr.io) - needs: build + needs: [build, publish] if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest permissions: @@ -130,6 +131,12 @@ jobs: done image-bin/amd64/openab-sb --version - uses: docker/setup-qemu-action@v3 + - name: Run the arm64 binary under emulation + run: | + set -euo pipefail + docker run --rm --platform linux/arm64 \ + -v "$PWD/image-bin/arm64/openab-sb:/tmp/openab-sb:ro" \ + debian:bookworm-slim /tmp/openab-sb --version - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: diff --git a/Dockerfile b/Dockerfile index b7444d6..d56b8e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ # this file as the Dockerfile. # # The config is not baked in. Mount it at /etc/openab-sb/openab-sb.toml. It -# must set listen = "127.0.0.1:8796" and an audit_path under /var/lib/openab-sb. +# must set listen = "127.0.0.1:8790" and an audit_path under /var/lib/openab-sb. # The switchboard binds loopback, so only processes in the same pod (the # tailscale sidecar) can reach it. # diff --git a/README.md b/README.md index 29625df..57404a0 100644 --- a/README.md +++ b/README.md @@ -255,19 +255,25 @@ There is no self-registration. ### Container image -Each `v*` tag publishes a multi-arch (amd64, arm64) image to GHCR: +Each `v*` tag publishes a multi-arch (amd64, arm64) image to GHCR. The image job runs only after +the GitHub Release for the tag has been created. A stable tag (no prerelease suffix) also moves +`:latest`. A prerelease tag does not. ```bash -docker pull ghcr.io/openabdev/openab-sb:0.2.2 # also :0.2 +docker pull ghcr.io/openabdev/openab-sb:0.2.2 # also :0.2 and :latest ``` +A new GHCR package starts private, so anonymous `docker pull` fails until someone sets it to +Public once: open the `openab-sb` package under the openabdev org, then Package settings, then +Change visibility to Public. Authenticated pulls work before that change. + The image is `debian:bookworm-slim` with the release's static `openab-sb` binary, `curl` and `ca-certificates`. It runs as the non-root user `openab-sb` (UID and GID 10001), and its entrypoint is `openab-sb serve -c /etc/openab-sb/openab-sb.toml`. The config is not baked in: mount it at that -path. It must set `listen = "127.0.0.1:8796"` and an `audit_path` under `/var/lib/openab-sb`, +path. It must set `listen = "127.0.0.1:8790"` and an `audit_path` under `/var/lib/openab-sb`, which the image creates and owns for the audit file. -A pod can probe the switchboard with `curl -fsS --max-time 2 http://127.0.0.1:8796/healthz` from inside the +A pod can probe the switchboard with `curl -fsS --max-time 2 http://127.0.0.1:8790/healthz` from inside the container. Keep the listener on loopback, and put TLS in a sidecar such as `tailscale serve`. The switchboard binds loopback and refuses anything else unless you set