Two issues from the first server cutover:
1. SPA loaded white-on-black blank because import.meta.env.VITE_AZURE_TENANT_ID
and VITE_AZURE_CLIENT_ID were undefined at runtime. Vite reads VITE_* at
*build time* and inlines them into the bundle; passing them only as
runtime container env vars is too late.
- Dockerfile.v2: declare ARG VITE_AZURE_TENANT_ID, VITE_AZURE_CLIENT_ID,
VITE_BASE; export as ENV before `npm run build`.
- docker-compose.v2.yml: forward AZURE_TENANT_ID / AZURE_CLIENT_ID /
VITE_BASE through `build.args` so the cutover .env values reach Vite.
2. cutover-in-place.sh stopped V1 with `-p social-listening`, but V1's actual
compose project name was `social-reporting` (parent dir). Old V1 containers
were left running. Now we try both project names AND sweep by container
name pattern (anything matching social-listening or social-reporting-db-1
that isn't a V2 container).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
# V2 image: builds operator-app SPA, copies server + pipeline + templates, runs Node.
|
|
FROM node:20-slim AS ui-build
|
|
|
|
WORKDIR /build
|
|
COPY v2/package.json v2/package-lock.json* ./
|
|
COPY v2/operator-app/package.json operator-app/package.json
|
|
COPY v2/templates/dashboard_template/package.json templates/dashboard_template/package.json
|
|
RUN npm install --include=dev --no-audit --no-fund
|
|
|
|
COPY v2/operator-app ./operator-app
|
|
COPY v2/tsconfig.base.json ./tsconfig.base.json
|
|
|
|
# Vite reads VITE_* vars at build time (they're inlined into the bundle), not runtime.
|
|
# Pass these from compose `build.args` so the SPA knows the Azure tenant/client IDs.
|
|
ARG VITE_AZURE_TENANT_ID=""
|
|
ARG VITE_AZURE_CLIENT_ID=""
|
|
ARG VITE_BASE="/social-reports/"
|
|
ENV VITE_AZURE_TENANT_ID=$VITE_AZURE_TENANT_ID
|
|
ENV VITE_AZURE_CLIENT_ID=$VITE_AZURE_CLIENT_ID
|
|
ENV VITE_BASE=$VITE_BASE
|
|
RUN npm run build --workspace operator-app
|
|
|
|
FROM node:20-slim AS runtime
|
|
|
|
# ffmpeg for Stage 4 frame extraction
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ffmpeg ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
COPY v2/package.json v2/package-lock.json* ./
|
|
RUN npm install --omit=dev --no-audit --no-fund
|
|
|
|
COPY v2/tsconfig.base.json v2/tsconfig.json ./
|
|
COPY v2/server ./server
|
|
COPY v2/pipeline ./pipeline
|
|
COPY v2/templates ./templates
|
|
COPY v2/db ./db
|
|
|
|
# UI build artifacts
|
|
COPY --from=ui-build /build/operator-app/dist ./operator-app/dist
|
|
|
|
RUN mkdir -p briefs && useradd -u 1000 -m -s /bin/bash node-v2 || true
|
|
RUN chown -R 1000:1000 /app
|
|
|
|
USER 1000
|
|
EXPOSE 3457
|
|
CMD ["npx", "tsx", "server/index.ts"]
|