### Summary of Changes - **Version Metadata Generation**: - `ci/docker/www/Dockerfile` & `ci/docker/docs/Dockerfile` accept `COMMIT_SHA` and `VERSION` build args and write `/usr/share/nginx/html/version.json`. - `ci/config/nginx/default.conf` configures `location = /version.json` with `Cache-Control: no-store, no-cache, must-revalidate` so verification is never stale. - **Automated Rollout Verification**: - `.github/workflows/services-www-releases-dispatch-release.yml` - `.github/workflows/services-docs-next-required.yml` - `.github/workflows/services-www-next-required.yml` - Added `verify-rollout` job that polls `https://www.ermnvldmr.com/version.json` and `https://docs.ermnvldmr.com/version.json` with 10s intervals (up to 5 minutes) to ensure the commit actively rolls out to users.
51 lines
1.7 KiB
Docker
51 lines
1.7 KiB
Docker
# Stage 1: Build
|
|
FROM node:20-alpine AS builder
|
|
|
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN npm install -g pnpm@9.12.3
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy monorepo configuration
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
|
|
# Copy all package.json files to allow pnpm to fetch dependencies
|
|
COPY packages/eslint-config/package.json ./packages/eslint-config/
|
|
COPY packages/rsbuild-config/package.json ./packages/rsbuild-config/
|
|
COPY packages/ssg/package.json ./packages/ssg/
|
|
COPY packages/stl/package.json ./packages/stl/
|
|
COPY packages/storybook-config/package.json ./packages/storybook-config/
|
|
COPY packages/ui/package.json ./packages/ui/
|
|
COPY packages/kits/package.json ./packages/kits/
|
|
COPY packages/cli/package.json ./packages/cli/
|
|
COPY packages/i18n/package.json ./packages/i18n/
|
|
COPY services/www/package.json ./services/www/
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build dependencies
|
|
RUN pnpm build:deps
|
|
|
|
# Build the website (all locales)
|
|
RUN pnpm --filter @ermnvldmr/www build:all
|
|
|
|
# Stage 2: Runtime
|
|
FROM nginx:alpine
|
|
|
|
ARG COMMIT_SHA="unknown"
|
|
ARG VERSION="latest"
|
|
|
|
COPY --from=builder /app/services/www/dist /usr/share/nginx/html
|
|
COPY ci/config/nginx/default.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Generate version metadata for automated rollout verification
|
|
RUN printf '{\n "service": "www",\n "version": "%s",\n "commit": "%s",\n "builtAt": "%s"\n}\n' \
|
|
"${VERSION}" "${COMMIT_SHA}" "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" > /usr/share/nginx/html/version.json
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"] |