Skip to content

refactor: simplify image builds - #28

Merged
clvsh merged 1 commit into
mainfrom
agent/simplify-image-build
Oct 21, 2026
Merged

clvsh merged 1 commit into
mainfrom
agent/simplify-image-build

Conversation

@clvsh

@clvsh clvsh commented Jul 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • replace per-release binary versions and architecture checksums with supported major channels, package repositories, and upstream installers
  • track PHP 8.4/8.5 minor image tags so FrankenPHP supplies the current patch release
  • install current compatible sqlsrv/pdo_sqlsrv and current svgo
  • replace Zinit with a straightforward Oh My Zsh setup in development and plain Zsh in production
  • simplify the bake matrix, scheduled refresh behavior, image export/load flow, and manifest publishing
  • remove the unsafe wip helper and redundant x wrapper

Why

The existing update path required changing versions and checksums throughout the Dockerfile even when only an upstream patch release changed. This keeps intentional compatibility boundaries (PHP/Node/pnpm/Composer major or minor channels and the Debian variants) while allowing routine upstream updates to flow through scheduled builds.

This is the consolidated follow-up to the pinning discussion in #27.

Tag impact

Exact PHP patch tags are no longer generated. Published tags track the supported PHP minor (php8.4, php8.5) plus the existing latest, PHP-major, Debian, and development aliases.

Validation

  • docker build --pull --build-arg VERSION=8.5-trixie --target dev -t frankenphp:simplified-dev .
  • docker run --rm -v "$PWD/test.php:/test.php:ro" frankenphp:simplified-dev php /test.php dev
  • docker run --rm frankenphp:simplified-dev zsh -i -c 'echo dev-shell-ok'
  • docker build --pull --build-arg VERSION=8.5-trixie --target prod -t frankenphp:simplified-prod .
  • docker run --rm -v "$PWD/test.php:/test.php:ro" frankenphp:simplified-prod php /test.php production
  • docker build --pull --build-arg VERSION=8.4-bookworm --target prod -t frankenphp:simplified-bookworm-prod .
  • docker run --rm -v "$PWD/test.php:/test.php:ro" frankenphp:simplified-bookworm-prod php /test.php production
  • docker buildx bake --print
  • docker build --check --build-arg VERSION=8.5-trixie --target dev .
  • actionlint .github/workflows/pipeline.yml
  • zsh -n .zshrc .zshrc.prod
  • php -l test.php
  • git diff --check

All local checks passed on arm64; the PR workflow covers both supported architectures.

Summary by CodeRabbit

  • New Features

    • Added support for building and publishing PHP 8.4 and 8.5 minor-version image lines.
    • Added configurable latest-version aliases and optional cache refresh controls.
    • Updated development images with current Node, pnpm, and developer tooling.
  • Improvements

    • Simplified CI behavior for pull requests, scheduled runs, and image publishing.
    • Updated the development shell to use Oh My Zsh and streamlined production shell setup.
    • Improved local XDG directory handling.
  • Documentation

    • Updated build instructions, supported tags, shell details, and version examples.
  • Removed

    • Removed obsolete convenience scripts and legacy shell/tooling setup.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

The pull request changes PHP image versioning, Docker image tool installation, and development and production shell setup. It also updates the GitHub Actions workflow to build and test images, and to publish them for non-pull-request events.

Changes: PHP image build and shell setup

Layer / File(s) Summary
PHP minor-version matrix and tags
docker-bake.hcl, AGENTS.md, README.md
Docker Bake now accepts PHP minor versions, assigns latest aliases by minor version, and accepts a refresh value. The documentation describes the updated matrix and tag format.
Runtime toolchain and image setup
Dockerfile
The image uses updated Node, pnpm, SVGO, and PHP extension installation. It copies runtime tool artifacts and creates command symlinks.
Development and production shell setup
.env, .zshrc, .zshrc.prod, Dockerfile, usr/local/bin/wip, usr/local/bin/x
The development image installs shell tools and plugins and validates tool versions. The shell configurations change, and the wip and x scripts are removed.
Build, test, and publish workflow
.github/workflows/pipeline.yml
The workflow generates Docker Bake metadata and matrices, builds local image tarballs, and loads them for tests. Non-pull-request events also publish images and manifests.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant Pipeline as GitHub Actions pipeline
  participant Bake as Docker Bake
  participant Buildx as Docker Buildx
  participant Test as Test job
  participant Registry as Container registry
  Pipeline->>Bake: Generate metadata and build matrix
  Pipeline->>Buildx: Build image and write local tarball
  Buildx-->>Test: Provide image tarball
  Test->>Test: Load tarball and run tests on frankenphp:test
  Pipeline->>Registry: Publish image for non-pull-request events
Loading
Merge Risk: 🔵 Low · up to ea463

Default image builds should work as intended. Before merging, consider verifying the dev-image apt signing keys and restoring tag sanitization for overridden version inputs. Both are small, low-risk fixes.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the primary change: simplifying the image build process and related workflow logic.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (7 skipped: 7 unsupported.)

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@clvsh clvsh closed this Oct 21, 2026
@clvsh clvsh reopened this Oct 21, 2026
@clvsh
clvsh added this pull request to stack #30 October 21, 2026 17:18
@clvsh
clvsh marked this pull request as ready for review October 21, 2026 17:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T17:20:38.755000Z ea46321 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-21T17:26:46.382318Z ea46321 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments: 2
Dockerfile: 1

139-144: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Verify the GitHub CLI and eza signing-key fingerprints before apt trusts them.

The base stage checks the PostgreSQL key with sha256sum -c (Line 59). The new dev stage downloads the GitHub CLI keyring and the eza key and then trusts them for apt without any check. The eza key also comes from the moving main branch on raw.githubusercontent.com. If either source is compromised or changed, apt accepts packages signed by that key. Those packages then ship in every published -dev image. Key fingerprints rarely change. A fingerprint check is a small, fixed addition and keeps the policy used for the PostgreSQL key.

🔒️ Proposed fix
     && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /etc/apt/keyrings/githubcli-archive-keyring.gpg \
+    && gpg --show-keys --with-colons /etc/apt/keyrings/githubcli-archive-keyring.gpg | grep -q "^fpr:::::::::${GH_CLI_KEY_FPR}:" \
     && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
     ...
     && curl -fsSL https://raw.githubusercontent.com/eza-community/eza/main/deb.asc \
         | gpg --dearmor -o /etc/apt/keyrings/eza.gpg \
+    && gpg --show-keys --with-colons /etc/apt/keyrings/eza.gpg | grep -q "^fpr:::::::::${EZA_KEY_FPR}:" \

Declare GH_CLI_KEY_FPR and EZA_KEY_FPR as uppercase ARGs that hold the published fingerprints.

docker-bake.hcl: 1

25-27: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restore a clean-tag function for tag values.

PHP_VERSION and LATEST are user-overridable inputs. The new tag() function puts name directly into the tag string. The previous tag-cleaning step is removed. Any value with characters that are not valid in a tag, such as /, +, or uppercase letters, now produces an invalid tag reference. The generated tag also feeds imagetools create in the push job. The repository guideline requires a dedicated sanitizer for tag values.

♻️ Proposed fix
+function "clean_tag" {
+    params = [tag]
+    result = substr(regex_replace(regex_replace(lower(tag), "[^a-z0-9_.-]", "-"), "^[.-]+", ""), 0, 128)
+}
+
 function "tag" {
     params = [name, os, variant]
-    result = "${IMAGE_NAME}:${name}${os == "trixie" ? "" : "-${os}"}${variant == "dev" ? "-dev" : ""}"
+    result = "${IMAGE_NAME}:${clean_tag("${name}${os == "trixie" ? "" : "-${os}"}${variant == "dev" ? "-dev" : ""}")}"
 }

As per coding guidelines: "Use semantic versioning for image tags and sanitize tag values with a dedicated clean-tag function."

Also applies to: 47-53

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 38aff564-8dbc-4587-b82a-5952d4af782b
📥 Commits

Reviewing files that changed from the base of the PR and between 7d720c0 and ea46321.

📒 Files selected for processing: 10
  • .env
  • .github/workflows/pipeline.yml
  • .zshrc
  • .zshrc.prod
  • AGENTS.md
  • Dockerfile
  • README.md
  • docker-bake.hcl
  • usr/local/bin/wip
  • usr/local/bin/x
💤 Files with no reviewable changes: 2
  • usr/local/bin/wip
  • usr/local/bin/x

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@clvsh
clvsh merged commit f5c7d87 into main Oct 21, 2026
70 of 73 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