Pull requests / #3644

#3644 [Other] root Dockerfile: pass the source commit to the terminal stage (source build fails at v0.2.2)

open · @robertoetcheverryr · 0 コメント · GitHub で見る

BenchmarksAMD / HIPNVIDIA / CUDAModels & quantsDocumentation

本文

## Problem and result
At v0.2.2 (011c9e6) the documented source build (`docker build -t strata:src .`, "From source" in docs/DOCKER.md) fails in the terminal stage:

    the commit of these sources is unknown (no .git here, no --commit, no STRATA_COMMIT): the archive would carry no COMMIT file, and every `strata bench run` on it would be nonconforming

`.dockerignore` excludes `.git`, and the root Dockerfile's terminal stage takes no commit argument, so `package_terminal.py` has nothing to read. After this change the documented commands pass the commit, the build goes through, and the archive carries its COMMIT file.

## Related discussion
Same failure reported in a comment on #3503 (closed) and worked around locally in #3624 ("reported separately"). Build and docs fix only, no behavior or default change.

## Approach
- Dockerfile: the same handling `docker/Dockerfile` already uses, `ARG STRATA_COMMIT` → `ENV STRATA_BUILD_COMMIT`, which `build_commit()` already reads. Two lines in the terminal stage.
- docs/DOCKER.md: both "From source" commands (CUDA 13 and cuda12) now pass `--build-arg STRATA_COMMIT=$(git rev-parse HEAD)`, with one sentence on why.

Without the arg the value is empty, `build_commit()` rejects it and the build stops with the same message as before.

## Validation
**Passed:**
- `sudo docker compose build --build-arg STRATA_COMMIT=$(sudo git -C app rev-parse HEAD)` (compose build context = repo clone, args `CUDA_ARCHITECTURES: "86"`), v0.2.2 011c9e6 plus this change, Debian 13, Docker 29.9.2 (a82e528), RTX 3090: image built in 1056.1 s, terminal stage `strata --version` passed. COMMIT file carried into the image:

      $ docker run --rm --entrypoint cat strata:local /opt/strata/terminal/COMMIT
      011c9e600a93bbc9fd451c563501b5831c32bbca

**Failed:**
- Same build without this change: fails at `[terminal 4/5]` with the message above.

**Not run:**
- cuda12 variant, HIP, SYCL: not built. The change is in the terminal stage only, which doesn't depend on the backend.
- `docker/Dockerfile` / `docker/build.sh`: not touched.
- The docs commands exactly as written (`docker build -t strata:src ...`): built through docker compose with the same build arg instead.

## Limits
A bare `docker build .` without the arg still stops, as the packager intends (it refuses an archive with no commit). Making it work with no arg would mean either keeping `.git` in the build context or letting the packager warn instead of fail. I left both out because they change existing behavior; happy to do either if preferred.

関連リンク

インストール・モデル・リリースへのサイト内リンク。