diff --git a/docker-compose.yml b/docker-compose.yml index 0fe4cc3..80738c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,9 @@ services: web: - build: ./web + build: + context: ./web + args: + SOURCE_COMMIT: ${SOURCE_COMMIT:-dev} container_name: lazyflat-web restart: unless-stopped depends_on: diff --git a/web/Dockerfile b/web/Dockerfile index ac31eb5..ba5000c 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -8,6 +8,13 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . +# Stamp the image with the git SHA so the web footer can show which commit is +# live. Coolify passes SOURCE_COMMIT as a build arg on every deploy; outside +# Coolify the ARG defaults to "dev". Placed after COPY so only this thin layer +# rebuilds when the SHA changes — pip install stays cached. +ARG SOURCE_COMMIT=dev +ENV GIT_COMMIT=${SOURCE_COMMIT} + EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ diff --git a/web/common.py b/web/common.py index d8a89f3..35d7e39 100644 --- a/web/common.py +++ b/web/common.py @@ -23,7 +23,7 @@ import db import notifications from apply_client import ApplyClient, _row_to_profile from auth import issue_csrf_token -from settings import APPLY_FAILURE_THRESHOLD, INTERNAL_API_KEY +from settings import APPLY_FAILURE_THRESHOLD, GIT_COMMIT, INTERNAL_API_KEY logger = logging.getLogger("web") @@ -114,6 +114,8 @@ def base_context(request: Request, user, active_tab: str) -> dict: "csrf": issue_csrf_token(user["id"]), "active_tab": active_tab, "is_admin": bool(user["is_admin"]), + "git_commit": GIT_COMMIT, + "git_commit_short": GIT_COMMIT[:7] if GIT_COMMIT and GIT_COMMIT != "dev" else GIT_COMMIT, } diff --git a/web/settings.py b/web/settings.py index 5df1d2e..6c3db0c 100644 --- a/web/settings.py +++ b/web/settings.py @@ -59,3 +59,8 @@ PUBLIC_URL: str = getenv("PUBLIC_URL", "https://flat.lab.moritz.run") # --- LLM enrichment (Anthropic Haiku) ----------------------------------------- ANTHROPIC_API_KEY: str = getenv("ANTHROPIC_API_KEY", "") ANTHROPIC_MODEL: str = getenv("ANTHROPIC_MODEL", "claude-haiku-4-5-20251001") + +# --- Build info -------------------------------------------------------------- +# Baked into the image at docker build time via the Dockerfile ARG; rendered in +# the site footer so the running commit is visible at a glance. +GIT_COMMIT: str = getenv("GIT_COMMIT", "dev") diff --git a/web/templates/_layout.html b/web/templates/_layout.html index 418414f..f93a029 100644 --- a/web/templates/_layout.html +++ b/web/templates/_layout.html @@ -31,5 +31,9 @@ {% endblock %}