---
estimated_steps: 12
estimated_files: 2
skills_used: []
---

# T02: Update Docker build to pass git commit SHA to web image and deploy

Update Dockerfile.web and docker-compose.yml on ub01 to pass GIT_COMMIT_SHA as a build arg to the web service. Rebuild and deploy to verify the footer renders with real version info.

**Important context:**
- All Docker files are on ub01 at `/vmPool/r/repos/xpltdco/chrysopedia/`.
- Use SSH to edit files: `ssh ub01` then edit in `/vmPool/r/repos/xpltdco/chrysopedia/`.
- Current `docker/Dockerfile.web` is a two-stage build: `node:22-alpine` builds, `nginx:1.27-alpine` serves.
- Add `ARG VITE_GIT_COMMIT=dev` before the `RUN npm run build` line. Add `ENV VITE_GIT_COMMIT=$VITE_GIT_COMMIT` so Vite can read it via `process.env.VITE_GIT_COMMIT`.
- In `docker-compose.yml`, add `VITE_GIT_COMMIT: ${GIT_COMMIT_SHA:-dev}` to the web service's `build.args`.
- The API service already has `GIT_COMMIT_SHA: ${GIT_COMMIT_SHA:-unknown}` in its build args — follow the same pattern.
- After editing, commit the changes, then rebuild: `docker compose build chrysopedia-web && docker compose up -d chrysopedia-web`.
- After deploy, verify at http://ub01:8096 — the footer should be visible on the home page.
- If the commit SHA shows as 'dev', that's expected when `GIT_COMMIT_SHA` env var isn't set. To test with a real SHA: `GIT_COMMIT_SHA=$(git rev-parse --short HEAD) docker compose build chrysopedia-web`.
- Also push the T01 frontend changes to ub01 first — either git push from local + git pull on ub01, or copy files via SCP.

## Inputs

- ``docker/Dockerfile.web` — current two-stage build with no build args`
- ``docker-compose.yml` — web service section with no build args`

## Expected Output

- ``docker/Dockerfile.web` — updated with `ARG VITE_GIT_COMMIT` and `ENV VITE_GIT_COMMIT``
- ``docker-compose.yml` — web service build args include `VITE_GIT_COMMIT``

## Verification

ssh ub01 'cd /vmPool/r/repos/xpltdco/chrysopedia && grep -q VITE_GIT_COMMIT docker/Dockerfile.web && grep -q VITE_GIT_COMMIT docker-compose.yml && echo Docker files OK' && echo 'Verify footer at http://ub01:8096'
