diff --git a/Dockerfile b/Dockerfile index 0cd407d..e41011b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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