MEGA-BOQ-WEBAPP/update_build_marker.sh
MEGA INFRA 7fd221288a Make the build marker actually report the build
It read 'dev' on the live site, so it was decoration rather than evidence.
Cause: Coolify does not pass a commit SHA into a Docker Compose build, so my
${BUILD_SHA:-dev} fallback always won.

Read from build.txt in the repo instead, which cannot drift from what is
deployed. Two things that took a try each:
- Docker's ENV does not evaluate $(cat file), so the file is copied into the
  image and read at startup.
- Streamlit executes app.py in an exec context where __file__ is not
  guaranteed; a bare reference to it inside build_sha() would have taken the
  whole app down. It now walks a list of candidate paths and never raises.

Verified: docker build ok; build.txt inside the image reads e1f4127;
build_sha() resolves to e1f4127 in the container; the sidebar renders it.
2026-10-02 21:57:13 +02:00

7 lines
308 B
Bash
Executable file

#!/usr/bin/env bash
# Rewrite build.txt to the current commit. Run as part of committing, so the
# marker in the sidebar always names the build that is actually deployed.
# Wired up as a git post-commit hook when the repo is set up locally.
set -e
cd "$(dirname "$0")"
git rev-parse --short HEAD > build.txt