feat: add Dockerfile-supabase and rework Dockerfile-multigres as layered images#2160
Open
mkindahl wants to merge 1 commit into
Open
feat: add Dockerfile-supabase and rework Dockerfile-multigres as layered images#2160mkindahl wants to merge 1 commit into
mkindahl wants to merge 1 commit into
Conversation
mkindahl
commented
May 20, 2026
1ed9ea8 to
a9551ce
Compare
…ered image - Add Dockerfile-supabase: parameterised replacement for Dockerfile-15/17, selects PostgreSQL version via --build-arg PG_VERSION (default 17) - Rewrite Dockerfile-multigres: two-stage layered build on top of supabase base image; pgctld compiled from Go source (pinned to MUL-484 commit for --pg-initdb-sql-dirs support), pgbackrest added, wal-g files removed - Add docker/pgctld/pgctld wrapper script - Update ansible/vars.yml: add release_matrix_base and release_matrix_layered sections; tags derived from postgres_release via release_key at build time - Update dockerhub-release-matrix.yml and manual-docker-release.yml: split build into two sequential jobs (build_base_images then build_layered_images) so multigres is built after its base image is pushed to the registry - Update docker-image-test.yml: replace Dockerfile-15/17 matrix entries with Dockerfile-supabase; add inline base build for multigres; always pass --target production; use base_dockerfile field to discriminate layered builds - Update docker-image-test.nix and image-size-analyzer.nix: add --pg-version flag and Dockerfile-supabase support - Update README.md with new Dockerfile documentation
a9551ce to
8a8de35
Compare
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.
Add
Dockerfile-supabaseand rewriteDockerfile-multigresas a layered imageSummary
The existing
Dockerfile-15andDockerfile-17are near-identical files that diverge only in a handful of version-specific lines. This PR introducesDockerfile-supabase, a single parameterised Dockerfile that replaces both, selectable via--build-arg PG_VERSION=15|17(default 17). It also rewritesDockerfile-multigresfrom a self-contained Nix-based build into a thin layered image built on top ofDockerfile-supabase, which significantly reduces duplication and makes the multigres image easier to keep in sync with the base.Dockerfile-15,Dockerfile-17, andDockerfile-orioledb-17are unchanged and remain in the repo.Dockerfile-supabasereplacesDockerfile-15andDockerfile-17in the release workflows;Dockerfile-orioledb-17continues to be built viarelease_matrix_layered.Changes
Dockerfile-supabase(new)Parameterised replacement for
Dockerfile-15andDockerfile-17. The three-stage structure (nix-builder,gosu-builder,production) is identical to the existing files. Version-specific differences (strippingtimescaledb/plv8, commenting outdb_user_namespace) are gated on[ "$PG_VERSION" -ge 17 ]at build time.Dockerfile-multigres(rewritten)Reduced from ~320 lines to ~70. A
pgctld-builderstage compilespgctldfrom Go source, pinned to the commit that introduced--pg-initdb-sql-dirs(MUL-484). The final stage doesFROM ${SUPABASE_IMAGE} AS production, addingpgbackrest, thepgctldbinary and wrapper script, a config template, and removing inheritedwal-gfiles. The base image is overridable via--build-arg SUPABASE_IMAGE.The old Dockerfile had separate
variant-17andvariant-orioledb-17final stages, selected via--target. These are replaced by a singleproductionstage — consistent with all other Dockerfiles. Thevariant-orioledb-17target is removed entirely; a multigres image layered on top of OrioleDB is not built in this PR (the standaloneDockerfile-orioledb-17image continues to be built viarelease_matrix_layered). All Dockerfiles now useproductionas the final stage name, so--target productionis passed unconditionally by the workflows and test scripts.docker/pgctld/pgctld(new, replacesdocker/pgctld/pgctld-wrapper)Wrapper script installed at
/usr/local/bin/pgctldthat injects--postgres-config-templateand--pg-initdb-sql-dirson everypgctldcall, so Kubernetes manifests work without extra flags.The old
pgctld-wrapperalso created a symlink/var/log/postgresql/postgresql.json -> /proc/1/fd/1to bridge PostgreSQL's JSON log file to the container's stdout (for kubelet + Vector, introduced in commit9313c070). This log-bridging is not carried over to the new wrapper. Whether pgctld itself now handles stdout logging needs to be confirmed before merging.ansible/vars.ymlvars.ymlis now the single source of truth for which images are built and how they are tagged. Two new sections are added:release_matrix_base— lists the base Dockerfiles to build (currentlyDockerfile-supabaseat pg15 and pg17)release_matrix_layered— lists the layered Dockerfiles to build on top of them (currentlyDockerfile-multigresandDockerfile-orioledb-17)Each entry carries a
release_keythat maps to a full version string inpostgres_release, and an optionaltag_suffix(e.g.-multigres). Image tags are derived entirely from these fields at workflow runtime — nothing is hardcoded in the workflow files themselves. To add a new version or change a tag, onlyvars.ymlneeds to be updated.Release workflows (
dockerhub-release-matrix.yml,manual-docker-release.yml)The release flow is split into two phases:
build_base_imagesbuilds and pushes the supabase base images first, thenbuild_layered_imagesbuilds images that depend on them. Strictly speaking, the OrioleDB image is not a layered image since it builds a patched version of Postgres inside the Dockerfile, but logically it is a layered image (if all patches were accepted into Postgres, it would be a pure layered image) and is therefore treated as one.The
preparejob now reads the explicit matrix fromvars.ymlrather than scanning the filesystem for Dockerfiles and inspecting their stage names. The singlebuild_release_imagejob is replaced by two sequential jobs:build_base_images— runs first, pushes base images to the registrybuild_layered_images— depends onbuild_base_images, passesSUPABASE_IMAGE=supabase/postgres:<base_tag>_<arch>as a build argThis ordering is required because
Dockerfile-multigresis now aFROMreference to the base image rather than a self-contained build. Tag computation inmerge_manifestis simplified from a ~15-line Nushell script per entry to a singleecho, since tags are precomputed inprepare.docker-image-test.ymlDockerfile-15andDockerfile-17replaced by twoDockerfile-supabaseentries withpg_version: "15"/"17"multigres-17entry gainsbase_dockerfile: Dockerfile-supabase, which triggers an inline base build before the layered build (each test runner has an isolated Docker daemon with no shared registry)--target productionis now hardcoded — all Dockerfiles use aproductionfinal stagemultigres-orioledb-17entry removed — that target no longer exists inDockerfile-multigresnix/packages/docker-image-test.nix,nix/packages/image-size-analyzer.nixBoth gain a
--pg-versionflag so they can pass--build-arg PG_VERSIONwhen building or analyzingDockerfile-supabase.Testing
The existing
docker-image-testsuite runs SQL regression tests against a live container for each matrix entry. The CI workflow now runs it against:Dockerfile-supabaseat pg15 and pg17 (replacing the formerDockerfile-15/Dockerfile-17entries)Dockerfile-multigres(multigres-17), withDockerfile-supabasebuilt inline as the baseDockerfile-orioledb-17tests are unchanged.Fixes MUL-483