fix(docker): revert to node:20-slim with 3GB memory

- Use node:20-slim for builder stage (better memory handling)

- Keep node:20-alpine for runtime (smaller image)

- Increase memory to 3072MB for build
This commit is contained in:
Ashwin Kumar 2026-04-10 18:11:45 +02:00
parent 897518c86e
commit 819ffef722

View file

@ -1,5 +1,5 @@
# Multi-stage build with memory optimization
FROM node:20-alpine AS builder
# Multi-stage build - using slim for better compatibility
FROM node:20-slim AS builder
WORKDIR /app
# Skip browser downloads
@ -7,22 +7,22 @@ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV CYPRESS_INSTALL_BINARY=0
# Install build dependencies
RUN apk add --no-cache python3 make g++
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 with reduced memory
# Install dependencies
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"
# Build with memory optimization (3GB for slim image)
ENV NODE_OPTIONS="--max-old-space-size=3072"
RUN npm run build
# Runtime stage
# Runtime stage - use alpine for smaller size
FROM node:20-alpine
WORKDIR /app