2026-04-10 18:17:36 +02:00
|
|
|
# Multi-stage build with memory optimization
|
2026-04-17 03:04:01 +02:00
|
|
|
FROM registry.nxtgauge.com/node:20-alpine AS builder
|
2026-04-09 00:09:02 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-04-10 17:46:17 +02:00
|
|
|
# Skip browser downloads
|
2026-04-09 02:16:41 +02:00
|
|
|
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
|
|
|
|
ENV CYPRESS_INSTALL_BINARY=0
|
2026-04-10 18:17:36 +02:00
|
|
|
ENV NODE_ENV=production
|
2026-04-09 02:16:41 +02:00
|
|
|
|
2026-04-10 19:37:19 +02:00
|
|
|
# Set API URLs for build (create .env file)
|
|
|
|
|
RUN echo "VITE_API_URL=http://localhost:9100" > .env && \
|
|
|
|
|
echo "PUBLIC_API_URL=http://localhost:9100/api" >> .env && \
|
|
|
|
|
echo "VITE_RUST_API_URL=http://localhost:9100/api" >> .env
|
2026-04-10 18:18:20 +02:00
|
|
|
|
2026-04-10 17:46:17 +02:00
|
|
|
# Install build dependencies
|
2026-04-17 03:04:01 +02:00
|
|
|
RUN apk add --no-cache python3 make g++ git
|
2026-04-09 03:20:29 +02:00
|
|
|
|
2026-04-10 17:46:17 +02:00
|
|
|
# Copy package files
|
2026-04-09 00:09:02 +02:00
|
|
|
COPY package*.json ./
|
|
|
|
|
|
2026-04-16 11:11:54 +02:00
|
|
|
# Install dependencies including devDependencies (needed for Tailwind/Vite)
|
|
|
|
|
RUN npm ci --legacy-peer-deps --prefer-offline --no-audit --include=dev
|
2026-04-10 17:46:17 +02:00
|
|
|
|
|
|
|
|
# Copy source
|
2026-04-09 00:09:02 +02:00
|
|
|
COPY . .
|
|
|
|
|
|
2026-04-10 18:17:36 +02:00
|
|
|
# Build with memory optimization
|
|
|
|
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
2026-04-10 17:46:17 +02:00
|
|
|
RUN npm run build
|
|
|
|
|
|
2026-04-10 18:17:36 +02:00
|
|
|
# Runtime stage
|
2026-04-16 19:30:25 +02:00
|
|
|
FROM registry.nxtgauge.com/node:20-alpine
|
2026-04-09 00:09:02 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2026-04-10 17:46:17 +02:00
|
|
|
# Copy built output
|
2026-04-09 00:09:02 +02:00
|
|
|
COPY --from=builder /app/.output ./.output
|
|
|
|
|
|
2026-04-10 01:21:36 +02:00
|
|
|
ENV PORT=9201
|
2026-04-09 00:09:02 +02:00
|
|
|
ENV HOST=0.0.0.0
|
2026-04-10 01:21:36 +02:00
|
|
|
EXPOSE 9201
|
2026-04-09 00:09:02 +02:00
|
|
|
|
|
|
|
|
CMD ["node", ".output/server/index.mjs"]
|