diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index b503306..5d9d542 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -26,6 +26,20 @@ jobs: fi echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + # The backend image is built with `context: ./backend`, so the + # repo-root version.json is OUTSIDE the build context and never + # reaches the container. Backend `main.py` falls back to a + # compile-time constant when /app/version.json is missing, which + # caused a real production drift: a redeploy of the v1.5.2 tree + # silently still reported "v1.5.0" in `/api/version` because the + # constant in main.py had been bumped but the file was not + # available to read. Stage version.json into the backend + # context here so the canonical file IS shipped and the + # constant only serves as a defensive fallback. The staged file + # is gitignored to keep `git status` clean for developers. + - name: stage version.json into backend build context + run: cp version.json backend/version.json + - name: set up qemu uses: docker/setup-qemu-action@v3 diff --git a/.gitignore b/.gitignore index 15e1747..5f10a6c 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,11 @@ venv.bak/ # Docker .dockerignore +# Build-time staged version.json (CI `cp version.json backend/`). +# The canonical file lives at repo root; this path is a transient +# copy for the backend Docker build context. +backend/version.json + # IDE .vscode/ .idea/