Skip to content

build: publish a FROM scratch artifact image of the gog binary - #4

Merged
n1hility merged 1 commit into
mainfrom
artifact-image
Sep 4, 2026
Merged

n1hility merged 1 commit into
mainfrom
artifact-image

Conversation

@n1hility

@n1hility n1hility commented Sep 4, 2026

Copy link
Copy Markdown

Publishes this fork's build output as a minimal artifact image, ghcr.io/rh-forge/gog, so rh-forge/openclaw-saw-image can inline the binary with a digest-pinned COPY --from instead of compiling gog inside its own build. Consumer side: rh-forge/openclaw-saw-image#25. Sibling: rh-forge/cli-microsoft365#5.

What's in it

  • Containerfile.artifact: digest-pinned hi/go:1.26 stage builds gog exactly as upstream's Dockerfile does (CGO_ENABLED=0, -trimpath, stripped, -X stamped), with GOARCH=${TARGETARCH} so the workflow's platforms: decides the published arch and a native arm64 trial works locally. The final stage is FROM scratch containing only /gog. Upstream's Dockerfile, docker.yml, ci.yml, and goreleaser config are untouched.
  • Publish workflows: the org's standard four (publish-image, publish-pr-image via workflow_run, cleanup-pr-image, prune-images), with two deliberate differences for an artifact that consumers pin by digest: sha-<commit> tags are immutable (a guard refuses to republish an existing one), and there is no semver/tag trigger. Version, commit, and commit date are stamped from git in the workflow, since .dockerignore excludes .git. Each push run writes the ready-to-paste tag@digest pin to the job summary.

Verified locally

Built and run natively on arm64 and emulated on amd64; the amd64 binary is a static x86-64 ELF (43.6 MB) that runs in a ubi9/ubi-minimal consumer stage with the version stamp intact. CI builds linux/amd64.

Follow-ups

  • gh workflow disable docker.yml so PRs stop also building upstream's alpine runtime image.
  • After first publish: link the gog package to package-perms and grant openclaw-saw-image read (manual GHCR UI step).

🤖 Generated with Claude Code

Containerfile.artifact builds gog exactly as upstream's Dockerfile does
(static, trimmed, stripped, -X stamped) in a digest-pinned hi/go stage and
emits a FROM scratch image whose only content is /gog. Consumers such as
rh-forge/openclaw-saw-image inline it with a digest-pinned COPY --from
instead of compiling gog inside their own builds.

The publish workflows are the organisation's standard set (publish-image,
publish-pr-image via workflow_run, cleanup-pr-image, prune-images) with
two deliberate differences for an artifact that downstream pins by digest:

- sha-<commit> tags are immutable. A guard step refuses to publish a
  commit whose sha- tag already exists, because re-pointing the tag would
  orphan the old digest and let prune-images delete it out from under
  every consumer pinned to it.
- No semver/tag trigger. This fork cuts no releases, and a tag build would
  be exactly the kind of same-commit republish the guard forbids.

Version, commit, and date are stamped from git in the workflow (commit
date rather than wall clock) because .dockerignore excludes .git. Each
push run writes the ready-to-paste tag@digest pin to the job summary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@n1hility
n1hility merged commit 0c4189e into main Sep 4, 2026
10 checks passed
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.

1 participant