fix(docker): build stamp shows v<version> (<commit>), not vmain#272
Merged
Conversation
The Docker build context ships no .git, so build.mjs's buildStamp() couldn't
read the commit and fell back to version-only; docker.yml also passed
ASB_VERSION=<branch> (e.g. "main"), so the in-app stamp read "vmain".
- build.mjs: when git is unavailable, fall back to $ASB_COMMIT (shortened to
7 chars) for the commit part.
- Dockerfile: add ARG/ENV ASB_COMMIT.
- docker.yml: pass ASB_COMMIT=${{ github.sha }} and drop ASB_VERSION so the
version comes from package.json → stamp reads e.g. `v0.5.0 (6b360e8)`.
Verified locally: `docker build --build-arg ASB_COMMIT=6b360e8… ` → served
stamp `v0.5.0 (6b360e8)`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvjXR2rzh6v5EBUzBbsvFV
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.
Problem
The container's in-app build stamp read
vmaininstead of the usualv0.5.0 (6b360e8). Two causes:.git, sobuild.mjsbuildStamp()couldn'tgit rev-parsethe commit → fell back to version-only.docker.ymlpassedASB_VERSION=${{ steps.meta.outputs.version }}which is the branch name (main) on branch pushes.Fix
build/build.mjs— when git is unavailable, fall back to$ASB_COMMIT(shortened to 7 chars) for the commit part. Local builds still prefer git (with-dirty).Dockerfile— addARG/ENV ASB_COMMIT..github/workflows/docker.yml— passASB_COMMIT=${{ github.sha }}and dropASB_VERSION, so the version comes frompackage.json→ stamp readsv<version> (<short-sha>)(e.g.v0.5.0 (6b360e8)). On a release tag,package.jsonalready equals the tag, so it stays consistent.Verified
docker build --build-arg ASB_COMMIT=6b360e8… .→ served/sqlstamp =v0.5.0 (6b360e8).🤖 Generated with Claude Code