feat(web): show git SHA in footer for post-deploy verification
Dockerfile takes SOURCE_COMMIT as a build arg and bakes it into the image as GIT_COMMIT. Coolify sets SOURCE_COMMIT on every deploy, so the value in the footer changes with each successful push → build. ARG is placed after COPY . so only a thin final layer rebuilds when the SHA changes; pip install stays cached. Outside Coolify the default is "dev" and the footer renders "build dev". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
81d6b65eae
commit
0144cb2844
5 changed files with 23 additions and 2 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: ./web
|
build:
|
||||||
|
context: ./web
|
||||||
|
args:
|
||||||
|
SOURCE_COMMIT: ${SOURCE_COMMIT:-dev}
|
||||||
container_name: lazyflat-web
|
container_name: lazyflat-web
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
COPY . .
|
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
|
EXPOSE 8000
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import db
|
||||||
import notifications
|
import notifications
|
||||||
from apply_client import ApplyClient, _row_to_profile
|
from apply_client import ApplyClient, _row_to_profile
|
||||||
from auth import issue_csrf_token
|
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")
|
logger = logging.getLogger("web")
|
||||||
|
|
@ -114,6 +114,8 @@ def base_context(request: Request, user, active_tab: str) -> dict:
|
||||||
"csrf": issue_csrf_token(user["id"]),
|
"csrf": issue_csrf_token(user["id"]),
|
||||||
"active_tab": active_tab,
|
"active_tab": active_tab,
|
||||||
"is_admin": bool(user["is_admin"]),
|
"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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,3 +59,8 @@ PUBLIC_URL: str = getenv("PUBLIC_URL", "https://flat.lab.moritz.run")
|
||||||
# --- LLM enrichment (Anthropic Haiku) -----------------------------------------
|
# --- LLM enrichment (Anthropic Haiku) -----------------------------------------
|
||||||
ANTHROPIC_API_KEY: str = getenv("ANTHROPIC_API_KEY", "")
|
ANTHROPIC_API_KEY: str = getenv("ANTHROPIC_API_KEY", "")
|
||||||
ANTHROPIC_MODEL: str = getenv("ANTHROPIC_MODEL", "claude-haiku-4-5-20251001")
|
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")
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,9 @@
|
||||||
</main>
|
</main>
|
||||||
<footer class="text-center text-xs text-slate-500 py-6">
|
<footer class="text-center text-xs text-slate-500 py-6">
|
||||||
Mit ♥ programmiert für Annika
|
Mit ♥ programmiert für Annika
|
||||||
|
{% if git_commit_short %}
|
||||||
|
<span class="mx-1">·</span>
|
||||||
|
<span title="{{ git_commit }}">build {{ git_commit_short }}</span>
|
||||||
|
{% endif %}
|
||||||
</footer>
|
</footer>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue