nxtgauge-frontend-solid/Dockerfile
Ashwin Kumar 5d73c7046a fix(docker): use Alpine and reduce memory for build
- Switch from node:20-slim to node:20-alpine for smaller image

- Reduce NODE_OPTIONS memory from 4096 to 2048

- Use Alpine apk instead of apt-get
2026-04-10 17:46:17 +02:00

36 lines
764 B
Docker

# Multi-stage build with memory optimization
FROM node:20-alpine AS builder
WORKDIR /app
# Skip browser downloads
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV CYPRESS_INSTALL_BINARY=0
# Install build dependencies
RUN apk add --no-cache python3 make g++
# Copy package files
COPY package*.json ./
# Install dependencies with reduced memory
RUN npm install --legacy-peer-deps --prefer-offline --no-audit
# Copy source
COPY . .
# Build with memory optimization (reduced from 4096 to 2048 for Alpine)
ENV NODE_OPTIONS="--max-old-space-size=2048"
RUN npm run build
# Runtime stage
FROM node:20-alpine
WORKDIR /app
# Copy built output
COPY --from=builder /app/.output ./.output
ENV PORT=9201
ENV HOST=0.0.0.0
EXPOSE 9201
CMD ["node", ".output/server/index.mjs"]