ci: publish Docker images to GHCR - #689
Open
hundehausen wants to merge 2 commits into
Open
Conversation
Build the existing Dockerfile on main and on cuprated-* tags. Push ghcr.io/cuprate/cuprated (nightly from main; version + latest from tags). Smoke-test --version before promoting multi-arch tags. The first push creates a private GHCR package; set cuprated public and optionally link it to the repository.
Document ghcr.io/cuprate/cuprated tags and a pull/run example for 0.1.0-preview.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Build the existing Dockerfile on
mainand oncuprated-*tags, and publishghcr.io/cuprate/cuprated.workflow_dispatchonmainnightly, short SHAcuprated-<version><version>,latest, short SHADockerfileor this workflowcuprated:testingonly)A
mainbuild never writeslatest.Why
cupratedalready has an in-tree Dockerfile. This adds a workflow so official images are built from the same tree and published to GHCR.Where
.github/workflows/docker.yml(new)Dockerfile(builderGITHUB_SHA, OCI labels)constants/build.rs(treat emptyGITHUB_SHAas unset; rebuild when it changes)How
git rev-parse HEADafter checkout is the commit used forGITHUB_SHAand for the smoke test. That avoids annotated-tag objects, whichcupratedrejects because they are not a 40-character commit.Per-arch jobs (
linux/amd64onubuntu-24.04,linux/arm64onubuntu-24.04-arm) push only<commit>-amd64/<commit>-arm64. After both passdocker run --rm "$IMG" --version(.commitmust match the expected commit), a merge job writes the multi-arch tags withdocker buildx imagetools create. A failed arch smoke test leaves the previousnightly/ version /latesttags in place.Actions in the new workflow are pinned to release SHAs. Existing workflows are unchanged.
Maintainer note: first GHCR publish
The workflow can publish the image. It cannot make that image publicly pullable. Package visibility is a GitHub Packages setting, not a workflow input, and it is independent of this repository being public.
The first successful push creates the
cupratedcontainer package under the Cuprate org (ghcr.io/cuprate/cuprated). GitHub’s default for a new container package is private. Until an org owner or package admin changes that:packages: write+GITHUB_TOKEN).docker pull ghcr.io/cuprate/cuprated:nightlyfails.To make the official image public (one-time):
mainrun, open the org package. It may only appear under the org’s private packages list at first.Later pushes reuse the same package. Visibility stays public.