Replaces the hardcoded version string in SettingsPage.tsx with a single
source of truth: a /VERSION file at the repo root. To cut a new release,
edit only that one file.
Frontend:
- vite.config.ts reads /VERSION at dev-server startup and injects it as
the __APP_VERSION__ global via Vite's define mechanism (compile-time,
zero runtime cost). Falls back to VITE_APP_VERSION env var for prod
Docker builds that pass it as a build arg.
- vite-env.d.ts adds the TypeScript declaration for __APP_VERSION__.
- SettingsPage.tsx Badge now renders {__APP_VERSION__} instead of the
literal string.
Backend:
- app.controller.ts reads /VERSION once at module load and includes
"version" in both GET /api and GET /api/health responses.
- NewRelicTransactionInterceptor tags every NR transaction with
newrelic.addCustomAttribute('appVersion', version) so releases can be
compared in NRQL: SELECT average(duration) FROM Transaction WHERE
appVersion = '2026.5.22'
Docker:
- docker-compose.yml mounts ./VERSION:/app/VERSION:ro in both backend
and frontend dev containers.
- Production Dockerfiles include COPY VERSION ./ with a comment
instructing CI to copy the root VERSION into each build context before
docker build.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
26 lines
695 B
Docker
26 lines
695 B
Docker
# ---- Production Dockerfile for React frontend ----
|
|
# Multi-stage build: compile to static assets, serve with nginx
|
|
|
|
# Stage 1: Build
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
# VERSION must be copied into the build context before `docker build`.
|
|
# In CI / deploy scripts run: cp VERSION frontend/VERSION (or pass VITE_APP_VERSION as build arg)
|
|
COPY VERSION ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: Serve with nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy the built static files
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy a small nginx config for SPA routing
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 3001
|
|
CMD ["nginx", "-g", "daemon off;"]
|