Skip to content

ci: publish the tested image to ghcr on every push to master - #4

Merged
jclaveau merged 1 commit into
masterfrom
ci/publish-to-ghcr
Aug 14, 2026
Merged

jclaveau merged 1 commit into
masterfrom
ci/publish-to-ghcr

Conversation

@jclaveau

@jclaveau jclaveau commented Aug 14, 2026 •

Copy link
Copy Markdown
Owner

Railway can build this repo's Dockerfile itself, but that means compiling pgbouncer from source at deploy time, in every environment — and a PR on a Railway-linked repo clones the whole project, so the same build repeats per preview. One build per commit, pulled everywhere, is cheaper and faster.

The job pushes the image the tests just ran, not a rebuild of the same commit: build already saves it as an artifact for rendered-config and live, so publish downloads that same tar and pushes it. Nothing reaches the registry that has not rendered its config, booted, and served traffic on both Postgres majors — and there is no second build to disagree with the first.

Three tags per commit:

  • latest
  • sha-<short>
  • <pgbouncer version>-<short>, read from ARG VERSION in the Dockerfile

The third is the one I would deploy: the image's identity is really (pgbouncer version, entrypoint commit), so a VERSION bump is legible from the tag alone, and a rollback is one variable change. latest is there for humans and for trying out Railway's image-based deploys.

Only on master, and only on push — pull requests already run the whole suite, and publishing every branch would fill the registry with images nobody deploys.

Deliberately amd64 only. make push builds linux/arm64,linux/amd64, and arm64 under QEMU on a GitHub runner is roughly ten times slower for a source compile. Railway is amd64; the multi-arch target stays available for manual use.

Rebased onto master now that #2 has landed, so the green above covers the entrypoint that is actually there rather than the one this branch forked from. Three changes rode along:

  • the version read from ARG VERSION is guarded — an unread one would have tagged the image -<short> and pushed that without a word
  • the step summary names the digest, read back from the registry with imagetools inspect, since a tag moves and a consumer pins
  • the token, actor and repository reach the script through env: rather than being interpolated into it

Two things to check after the first run, which I could not settle beforehand:

  • Package visibility. GitHub's docs say a package inherits the linked repository's permissions but not its visibility, and that the default is private. Every one of the 57 container packages on this account is public, so the practice may differ from the docs. If this one lands private, it is one toggle — Railway pulling a private image would otherwise need registry credentials on the service.
  • Package/repo linking. The package is named after the repository (ghcr.io/jclaveau/docker-pgbouncer), which is usually enough for GitHub to associate the two. The explicit mechanism is an org.opencontainers.image.source label, which would mean adding a LABEL to the Dockerfile — happy to do that if the association does not appear on its own.

Assisted-by: Claude:claude-opus-5[1m]

One build per commit, reused by the test jobs and then pushed, so nothing reaches the registry that has not rendered, booted and served traffic. The step summary names the digest read back from the registry, since a tag moves and a consumer pins.

Assisted-by: Claude:claude-opus-5[1m]
@jclaveau
jclaveau force-pushed the ci/publish-to-ghcr branch from c23a0b3 to a0c2fd0 Compare August 14, 2026 14:45
@jclaveau
jclaveau merged commit fe21559 into master Aug 14, 2026
5 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