2026-04-10 19:22:37 +02:00
|
|
|
# Multi-stage build with memory optimization
|
2026-07-08 03:37:18 +05:30
|
|
|
FROM ci.nxtgauge.com/admin/node:20-slim AS builder
|
2026-04-09 00:09:03 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-04-10 17:48:36 +02:00
|
|
|
# Skip browser downloads
|
2026-04-09 02:16:39 +02:00
|
|
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
|
|
|
|
ENV CYPRESS_INSTALL_BINARY=0
|
2026-08-14 04:15:32 +05:30
|
|
|
# NODE_ENV=production must NOT be set in this stage: with it set, `npm ci`
|
|
|
|
|
# skips devDependencies (vite, @tailwindcss/vite, etc.) that `npm run build`
|
|
|
|
|
# itself needs (SolidStart's build runs through vite) - the build then fails
|
|
|
|
|
# with ERR_MODULE_NOT_FOUND for 'vite'. It belongs in the runtime stage only,
|
|
|
|
|
# where it actually affects the running server, not here.
|
2026-04-10 19:22:37 +02:00
|
|
|
|
2026-07-18 22:23:19 +05:30
|
|
|
# GATEWAY_URL is resolved at runtime from the process environment (see
|
|
|
|
|
# src/lib/server/gateway.ts), not baked in at build time.
|
2026-04-09 02:16:39 +02:00
|
|
|
|
2026-04-10 17:48:36 +02:00
|
|
|
# Install build dependencies
|
2026-04-10 18:11:45 +02:00
|
|
|
RUN apt-get update && apt-get install -y python3 make g++ git && rm -rf /var/lib/apt/lists/*
|
2026-04-09 03:20:26 +02:00
|
|
|
|
2026-04-10 17:48:36 +02:00
|
|
|
# Copy package files
|
2026-04-09 00:09:03 +02:00
|
|
|
COPY package*.json ./
|
|
|
|
|
|
2026-08-14 04:15:32 +05:30
|
|
|
# Install dependencies (--include=dev is redundant with NODE_ENV unset, but
|
|
|
|
|
# explicit so this doesn't silently break again if NODE_ENV=production ever
|
|
|
|
|
# gets reintroduced above)
|
|
|
|
|
RUN npm ci --legacy-peer-deps --prefer-offline --no-audit --include=dev
|
2026-04-10 17:48:36 +02:00
|
|
|
|
|
|
|
|
# Copy source
|
2026-04-09 00:09:03 +02:00
|
|
|
COPY . .
|
|
|
|
|
|
2026-04-10 19:22:37 +02:00
|
|
|
# Build with memory optimization
|
|
|
|
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
2026-04-10 17:48:36 +02:00
|
|
|
RUN npm run build
|
|
|
|
|
|
2026-04-10 19:22:37 +02:00
|
|
|
# Runtime stage
|
2026-07-08 03:37:18 +05:30
|
|
|
FROM ci.nxtgauge.com/admin/node:20-alpine
|
2026-04-09 00:09:03 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-04-10 17:48:36 +02:00
|
|
|
# Copy built output
|
2026-04-09 00:09:03 +02:00
|
|
|
COPY --from=builder /app/.output ./.output
|
|
|
|
|
|
2026-08-14 04:15:32 +05:30
|
|
|
ENV NODE_ENV=production
|
2026-04-10 01:17:00 +02:00
|
|
|
ENV PORT=9202
|
2026-04-09 00:09:03 +02:00
|
|
|
ENV HOST=0.0.0.0
|
2026-04-10 01:17:00 +02:00
|
|
|
EXPOSE 9102
|
2026-04-09 00:09:03 +02:00
|
|
|
|
|
|
|
|
CMD ["node", ".output/server/index.mjs"]
|