build(version): inject real build version via ldflags (#47)
Dockerfile takes ARG VERSION (default "dev") and stamps it into main.version with -X. CD passes --build-arg VERSION=<git tag on v* builds, else the short sha>, so the running pod logs the actual build instead of "dev". Verified locally: `-ldflags -X main.version=...` embeds the string. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,7 +60,11 @@ jobs:
|
||||
run: |
|
||||
REGISTRY="localhost:5000"
|
||||
REF="${REGISTRY}/${{ env.IMAGE }}:${{ steps.meta.outputs.sha-tag }}"
|
||||
# Stamp the real build version: the git tag on a v* build, else the short sha.
|
||||
VERSION="${{ steps.meta.outputs.version-tag }}"
|
||||
[ -z "$VERSION" ] && VERSION="${{ steps.meta.outputs.sha-tag }}"
|
||||
buildah build \
|
||||
--build-arg VERSION="${VERSION}" \
|
||||
--label "org.opencontainers.image.revision=${{ github.sha }}" \
|
||||
--label "org.opencontainers.image.source=${{ github.repositoryUrl }}" \
|
||||
-t ${REF} \
|
||||
|
||||
Reference in New Issue
Block a user