Skip to content

Harden published Docker image and GHCR publish workflow#223

Merged
pinodeca merged 4 commits into
mainfrom
pinodeca/fix-docker-publish
Jun 10, 2026
Merged

Harden published Docker image and GHCR publish workflow#223
pinodeca merged 4 commits into
mainfrom
pinodeca/fix-docker-publish

Conversation

@pinodeca

@pinodeca pinodeca commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up improvements to the GHCR Docker-publishing work added across #218 and #222 (reviewed as a combined change, since #222 partly reversed #218). Scope is the published image and its publish workflow plus related docs; the local-dev Docker CI is intentionally untouched.

Image hardening (Dockerfile.release)

  • Pin init to the postgres database. The init script now connects with --dbname postgres instead of $POSTGRES_DB, so POSTGRES_DB can no longer desync the extension from the background worker (which targets postgres). Previously, -e POSTGRES_DB=myapp would silently install the extension where the worker never looks.
  • Install the .deb via apt so any dependencies the package declares resolve automatically (instead of bare dpkg -i).
  • Add a HEALTHCHECK based on pg_isready against the postgres database.

Publish workflow hardening (docker-publish.yml)

  • Default dry_run to true for manual workflow_dispatch, so pushing is a deliberate choice; release events still publish.
  • Add --limit 1000 to gh release list so the "highest stable release" computation isn't capped at the default 30.
  • Add an overwrite input (default false): immutable X.Y.Z-pg<major> tags are skipped if already present unless overwrite=true; floating pg<major>/latest tags always move forward.
  • End-to-end smoke test: the smoke step now runs df.start('SELECT 1') and polls df.status to completed, proving the background worker actually executes (would have caught the POSTGRES_DB mismatch above).
  • Provenance + SBOM attestations: a second cache-backed build-push-action (push: true, provenance, sbom) publishes the byte-identical image with attestations, since a --loaded image can't carry them.

Documentation

  • docs/http-security.md: corrected the stale "production Dockerfile" claim — the source Dockerfile uses http-allow-test-domains; the released .deb / Dockerfile.release use http-allow-azure-domains.
  • README.md: moved the GHCR run examples into the Packages section (PG17 + PG18 side by side with psql), noted that POSTGRES_DB is ignored, recommended pinning immutable tags, and clarified that the GHCR image and the source Dockerfile are different artifacts. The Development → Docker subsection now keeps only the from-source flow.
  • prompts/pg_durable-release.md: added a "Publish the Public Image to GHCR" runbook covering the ref/dry_run/overwrite inputs and typical flows.

Notes / deferred

  • Action SHA pinning was deferred. Pinning the publish workflow's actions to commit SHAs is good practice, but the rest of the repo uses floating major tags; tracking it as a repo-wide change rather than doing it inconsistently here.

Testing

Trigger workflow on this PR branch, set dry run to true.

pinodeca added 4 commits June 10, 2026 20:24
- Pin init script to the postgres database so POSTGRES_DB cannot
  desync the extension from the worker (Dockerfile.release)
- Install the .deb via apt so declared deps resolve
- Add a HEALTHCHECK to the published image
- Expand README Docker/Packages docs with GHCR tag listing and
  PG17/PG18 run examples
- Add fix.md triage of remaining Docker-publish improvements
- Default dry_run to true for manual dispatch
- Add --limit to gh release list for highest-stable resolution
- Add overwrite input to protect immutable X.Y.Z-pg<major> tags
- Smoke test now runs a durable function end-to-end
- Publish with provenance + SBOM via cache-backed second build
- Correct stale 'production Dockerfile' HTTP-feature claim (http-security)
- Move GHCR run examples into Packages; PG17/PG18 side-by-side + psql
- Note POSTGRES_DB is ignored and recommend pinning immutable tags
- Clarify GHCR image vs source Dockerfile are different artifacts
- Add Step 7b GHCR publish runbook (ref/dry_run/overwrite inputs)
@pinodeca pinodeca merged commit 8b1e7bc into main Jun 10, 2026
6 of 7 checks passed
@pinodeca pinodeca deleted the pinodeca/fix-docker-publish branch June 10, 2026 22:31
This was referenced Jun 17, 2026
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