nxtgauge-admin-solid/Dockerfile
Ashwin Kumar Sivakumar d1db169162
All checks were successful
build-and-release / build (push) Successful in 1m44s
fix(admin-auth): read GATEWAY_URL from process.env instead of build-time Vite var
Server-side gateway proxy (login, forgot-password, reset-password, all
/api/admin/* and /api/gateway/* calls) was reading import.meta.env.VITE_GATEWAY_URL,
which Vite only inlines at build time. The Dockerfile wrote GATEWAY_URL (no VITE_
prefix, and localhost besides) to .env at build time, so the var was never picked
up and the fallback http://localhost:9100 got baked into the server bundle
permanently — unreachable inside the pod, causing every admin auth call to 502
regardless of the correct GATEWAY_URL already set in the k8s ConfigMap.

Switch to process.env.GATEWAY_URL, read at runtime like the rest of the server
config already is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-18 22:23:19 +05:30

40 lines
949 B
Docker

# Multi-stage build with memory optimization
FROM ci.nxtgauge.com/admin/node:20-slim AS builder
WORKDIR /app
# Skip browser downloads
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV CYPRESS_INSTALL_BINARY=0
ENV NODE_ENV=production
# GATEWAY_URL is resolved at runtime from the process environment (see
# src/lib/server/gateway.ts), not baked in at build time.
# Install build dependencies
RUN apt-get update && apt-get install -y python3 make g++ git && rm -rf /var/lib/apt/lists/*
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --legacy-peer-deps --prefer-offline --no-audit
# Copy source
COPY . .
# Build with memory optimization
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN npm run build
# Runtime stage
FROM ci.nxtgauge.com/admin/node:20-alpine
WORKDIR /app
# Copy built output
COPY --from=builder /app/.output ./.output
ENV PORT=9202
ENV HOST=0.0.0.0
EXPOSE 9102
CMD ["node", ".output/server/index.mjs"]