Fix build version showing "unknown" in production

The previous approach baked git rev-parse --short HEAD into the image
at Docker build time, but Dockhand's build context doesn't reliably
have .git available, so it silently fell back to "unknown" in
production even though the build itself succeeded. Replace it with a
plain VERSION file committed to the repo (a timestamp + short
description, updated by hand alongside each commit) that ships via the
same COPY . . as everything else - no git access needed inside the
build at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 14:00:42 -04:00
co-authored by Claude Sonnet 5
parent 8d1ce72372
commit 71d6158c60
5 changed files with 28 additions and 36 deletions
+2 -12
View File
@@ -5,9 +5,8 @@ FROM python:3.13.5-slim-bookworm
WORKDIR /app
# ffprobe (from ffmpeg) reads each video's duration for the library
# browser's "how long is this course" display; git is only needed
# transiently below, to bake this build's commit into the image
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg git \
# browser's "how long is this course" display
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# copy the dependencies file to the working directory
@@ -20,15 +19,6 @@ RUN pip install -r requirements.txt
# copy the content of the local src directory to the working directory
COPY . .
# Record which commit and when this image was built, so the running app
# can show it (Settings page, /health) - a full-image-rebuild webhook
# deploy gives no other visible confirmation that a push actually landed
# in the running container. .git is removed right after so the image
# doesn't carry the repo's full history.
RUN (git rev-parse --short HEAD 2>/dev/null || echo unknown) > /app/BUILD_VERSION \
&& date -u +"%Y-%m-%d %H:%M UTC" >> /app/BUILD_VERSION \
&& rm -rf /app/.git
EXPOSE 5000
# add healthcheck using Python standard library