Skip to content

Commit 0156d4d

Browse files
committed
docs(ci-testing): show the ARG/ENV mechanism for baking APP_BUILD_REF
Gemini review on #46: make Trap B's baked-env solution concrete with the Dockerfile ARG/ENV lines instead of describing it abstractly. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent 7b39cbf commit 0156d4d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

skills/docker-development/references/ci-testing.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,14 @@ A prod-like *variant* image (a profiler build, a debug build) is often published
161161
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
162162
```
163163
164-
**Trap B — no version in a `.git`-less build.** A Docker build has no `.git`, so anything that derives the version from git or the package's own metadata reads a placeholder — e.g. Composer's `InstalledVersions::getPrettyVersion(<root-package>)` returns `1.0.0+no-version-set`. Bake the version in explicitly: pass a build arg before the dependency install (`COMPOSER_ROOT_VERSION=1.2.3`, or the language's equivalent) so the metadata records it, or have the app read a baked env (`APP_BUILD_REF`) that the workflow sets from `github.ref_name`. With Trap A fixed, that ref is deterministically the release tag.
164+
**Trap B — no version in a `.git`-less build.** A Docker build has no `.git`, so anything that derives the version from git or the package's own metadata reads a placeholder — e.g. Composer's `InstalledVersions::getPrettyVersion(<root-package>)` returns `1.0.0+no-version-set`. Bake the version in explicitly: pass a build arg before the dependency install (`COMPOSER_ROOT_VERSION=1.2.3`, or the language's equivalent) so the metadata records it, or have the app read a baked env (`APP_BUILD_REF`) that the Dockerfile declares and the workflow sets from `github.ref_name`:
165+
166+
```dockerfile
167+
ARG APP_BUILD_REF
168+
ENV APP_BUILD_REF=$APP_BUILD_REF
169+
```
170+
171+
With Trap A fixed, that ref is deterministically the release tag.
165172

166173
## Local boot-test pitfalls
167174

0 commit comments

Comments
 (0)