The frontend container was serving the very first build (498-byte index.html) through every later deploy: `docker compose up -d` did not replace a config-identical service. Deploy now uses `build --pull` and `up --force-recreate`, the frontend image writes a .build-version marker, and the workflow fails the deploy if the served marker != the commit SHA.
28 lines
797 B
Docker
28 lines
797 B
Docker
FROM node:22-alpine AS build
|
|
|
|
# Same value as the backend's BUILD_VERSION so the client can compare them.
|
|
ARG BUILD_VERSION=unknown
|
|
ENV VITE_BUILD_VERSION=${BUILD_VERSION}
|
|
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --no-audit --no-fund
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
FROM nginx:alpine
|
|
|
|
# Defaults; override at runtime. The nginx entrypoint runs envsubst over
|
|
# /etc/nginx/templates/*.template, so only these referenced vars are replaced.
|
|
ENV API_TOKEN_HEADER=X-API-Token
|
|
ENV API_TOKEN=
|
|
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/templates/default.conf.template
|
|
|
|
# Marker so the deploy can verify the served build matches the commit.
|
|
ARG BUILD_VERSION=unknown
|
|
RUN printf '%s' "${BUILD_VERSION}" > /usr/share/nginx/html/.build-version
|
|
|
|
EXPOSE 80
|