From 204200394904010c8f42d0778975bb85571a0d8f Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Fri, 10 Apr 2026 19:22:37 +0200 Subject: [PATCH] fix(docker): add .env file and GATEWAY_URL for build - Copy .env file before npm install - Set GATEWAY_URL env var - Use npm ci instead of npm install --- Dockerfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e41011b..ce047ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,33 @@ -# Multi-stage build - using slim for better compatibility +# Multi-stage build with memory optimization FROM node:20-slim AS builder WORKDIR /app # Skip browser downloads ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 ENV CYPRESS_INSTALL_BINARY=0 +ENV NODE_ENV=production + +# Set API URL for build +ENV GATEWAY_URL=http://localhost:9100 # Install build dependencies RUN apt-get update && apt-get install -y python3 make g++ git && rm -rf /var/lib/apt/lists/* # Copy package files COPY package*.json ./ +COPY .env ./ # Install dependencies -RUN npm install --legacy-peer-deps --prefer-offline --no-audit +RUN npm ci --legacy-peer-deps --prefer-offline --no-audit # Copy source COPY . . -# Build with memory optimization (3GB for slim image) -ENV NODE_OPTIONS="--max-old-space-size=3072" +# Build with memory optimization +ENV NODE_OPTIONS="--max-old-space-size=4096" RUN npm run build -# Runtime stage - use alpine for smaller size +# Runtime stage FROM node:20-alpine WORKDIR /app