Skip to content

refactor: Replace Go installer with multi-stage Dockerfile and Bake - #16

Merged
ruxwez merged 2 commits into
mainfrom
refactor/declarative-images
Oct 25, 2026
Merged

ruxwez merged 2 commits into
mainfrom
refactor/declarative-images

Conversation

@ruxwez

@ruxwez ruxwez commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the Go installer (plyd, instance, utils, extensions/*.go) with a declarative setup. The image definition is now a multi-stage Dockerfile plus a docker-bake.hcl that lists the PostgreSQL versions and tags.

Problems this fixes in the current setup

  • Unsupported versions were skipped silently. Once postgres:latest moves to PG 19, ruxwez/postgres:latest would have been published without extensions.
  • make test ran on PG 13, where every installer step was skipped, so it tested nothing.
  • The pg_stat_statements check always passed.
  • pgvector was built with -march=native, so images could crash with an illegal instruction on older CPUs.
  • arm64 images were published without ever being tested.

What changes

Before After
Install logic ~300 lines of Go plus framework docs Dockerfile (one throwaway stage per source-built extension)
Versions / tags Duplicated across 2 workflows docker-bake.hcl
Unsupported version Silently skipped Build fails
Tests Build-only test on PG 13, plus a partial SQL check One functional extensions/<name>/test.sql per extension, run by tests/run.sh
CI amd64 only on PRs; main pushes without running tests amd64 and arm64 on native runners; only tested images are published
Extension versions Hardcoded in Go; PostGIS unpinned Pinned with ARGs that Renovate tracks (GitHub tags and the PGDG apt index)

Release scheme (new). Pushing a vX.Y.Z git tag publishes:

  • <pg>-vX.Y.Z: immutable, and CI refuses to overwrite it;
  • <pg>-vX: compatible updates only;
  • a GitHub release with a table of exact versions.

Weekly rebuilds only move <pg> and latest.

Extension versions are unchanged: pgvector 0.8.2, pgmq 1.11.1, PostGIS 3.6.4.

Testing

Run locally:

  • PG 18 and PG 14 build, and all extension tests pass.
  • Running the tests against vanilla postgres:18 fails as expected.
  • Labels, the release-notes script and the existing-tag check against Docker Hub all work.
  • Renovate dry-run detects every pinned dependency.
  • actionlint and shellcheck pass.

Not testable before merge:

  • Publish runs only on main.
  • Release runs only on v* tags.

This PR's CI covers build and test for all 10 combinations (5 versions × 2 architectures).

After merge

  • Check that the publish job updated 14–18 and latest.
  • Tag v1.0.0.
  • Install the Renovate GitHub App. It will propose pgvector 0.8.7 and pgmq 1.13.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QTN7At86i5TYDmozENSNv8

ruxwez and others added 2 commits October 25, 2026 18:17
The Go binary (plyd/instance/utils) reimplemented what Docker already
does and silently skipped unsupported versions, so `latest` could ship
without extensions and `make test` (PG 13) tested nothing.

- Dockerfile: extensions built from source in throwaway stages and
  copied into the final image; PostGIS pinned from PGDG apt. All
  versions pinned via ARGs that Renovate tracks.
- docker-bake.hcl: single source of truth for PG versions and tags.
  `latest` is an explicit alias of the newest supported major.
- Tests: one functional test.sql per extension, run by tests/run.sh
  against the final image.
- CI: one workflow that builds and tests every version on native amd64
  and arm64 runners and publishes only the tested images.
- Releases: vX.Y.Z git tags publish immutable <pg>-vX.Y.Z tags and
  <pg>-vX compatible-update tags, plus a GitHub release listing exact
  versions. Weekly rebuilds only move <pg> and latest.
- pgvector is built with OPTFLAGS="" so it no longer uses -march=native.
- Docs rewritten (EN/ES).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTN7At86i5TYDmozENSNv8
A skipped matrix job shows its name unexpanded, so pull requests listed
"Publish ${{ matrix.target }}".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTN7At86i5TYDmozENSNv8
@ruxwez
ruxwez merged commit b66fedf into main Oct 25, 2026
14 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