From 4d4a4a96b699ccaef58d8bc812c818186fd3a2dc Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 14 Jun 2026 19:32:24 -0700 Subject: [PATCH] fix docker commit metadata lookup --- archivebox/config/version.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/archivebox/config/version.py b/archivebox/config/version.py index 4bed168f..81f4f721 100644 --- a/archivebox/config/version.py +++ b/archivebox/config/version.py @@ -47,6 +47,15 @@ def get_COMMIT_HASH() -> str | None: if re.fullmatch(r"[0-9a-fA-F]{40}", env_commit_hash): return env_commit_hash + if IN_DOCKER: + try: + version_text = Path("/VERSION.txt").read_text() + match = re.search(r"^COMMIT_HASH=([0-9a-fA-F]{40})$", version_text, re.MULTILINE) + if match: + return match.group(1) + except Exception: + pass + def _read_git_file(git_dir: Path, ref: str) -> str | None: try: return git_dir.joinpath(ref).read_text().strip()