fix(docker-dev): stamp the git commit into rig image versions via a SOURCE_REVISION build arg (#893)
v2-ci / unit-tests (push) Has been cancelled

.dockerignore keeps .git/ out of the build context, so the in-image publish had
no repository and AssemblyInformationalVersion (Telemetry service.version) was a
bare 1.0.0. The Dockerfile now takes ARG SOURCE_REVISION and passes it to
dotnet publish as SourceRevisionId; docker-compose.yml forwards it as a build arg
for the host and migrator images; the new docker-dev/compose.sh wrapper exports
git rev-parse HEAD (suffixed -dirty for an uncommitted tree; an explicit value
wins) and runs docker compose with the base file. Without the arg the build
still succeeds as 1.0.0. The ARG sits after restore so a new commit does not
bust the restore layer. Mirrors ScadaBridge 7e34d7c2 (ScadaBridge#134).

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
Joseph Doherty
2026-11-12 23:05:31 -05:00
parent 00a5be261c
commit 6147e8dcba
4 changed files with 52 additions and 3 deletions
+9 -1
View File
@@ -113,7 +113,9 @@
# exercises.
#
# Usage:
# docker compose -f docker-dev/docker-compose.yml up -d --build
# docker-dev/compose.sh up -d --build # = docker compose -f docker-dev/docker-compose.yml ..., plus
# # SOURCE_REVISION=<git sha> so the images stamp the commit (#893)
# docker compose -f docker-dev/docker-compose.yml up -d --build # also works; images stamp a bare 1.0.0
# open http://localhost:9200 # central Blazor admin UI
# open http://localhost:8089 # Traefik dashboard (8080 is the sister scadalink stack)
#
@@ -250,6 +252,9 @@ services:
context: ..
dockerfile: docker-dev/Dockerfile
target: migrator
args:
# Commit stamp for the image's informational version (#893); docker-dev/compose.sh exports it.
SOURCE_REVISION: ${SOURCE_REVISION:-}
image: otopcua-migrator:dev
depends_on:
sql:
@@ -291,6 +296,9 @@ services:
context: ..
dockerfile: docker-dev/Dockerfile
target: runtime
args:
# Commit stamp for the image's informational version (#893); docker-dev/compose.sh exports it.
SOURCE_REVISION: ${SOURCE_REVISION:-}
image: otopcua-host:dev
# Per-node memory bounds. The full single-mesh stack (6 host nodes) OOM-killed
# central-1 on a loaded host. Each host node measured ~357 MiB idle-solo and