From 83ed4cb5181eb1ab7e2e049898d09d4a3518e7b3 Mon Sep 17 00:00:00 2001 From: fcarraUniSa Date: Wed, 10 Dec 2025 12:33:34 +0100 Subject: [PATCH] Update Dockerfile --- Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 107ca3f..39480d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ # Stage 1: Build the React Application -# Using standard node:20 (not slim/alpine) to ensure build tools like python/make/g++ are present FROM node:20 AS builder WORKDIR /app -# Copy package.json (and lock file if it exists) -COPY package*.json ./ +# Copy ONLY package.json. +# We intentionally IGNORE package-lock.json to prevent architecture mismatches +# (e.g., trying to install macOS binaries for esbuild on Linux). +COPY package.json ./ -# Install dependencies using legacy-peer-deps to avoid version conflicts -RUN npm install --legacy-peer-deps +# Install dependencies from scratch for the container's architecture +RUN npm install # Copy the rest of the application source code COPY . . @@ -17,16 +18,15 @@ COPY . . RUN npm run build # Stage 2: Setup the Production Server -# Using standard node:20 to ensure native modules (like pg/mysql drivers) install correctly FROM node:20 WORKDIR /app -# Copy package.json again for production dependencies -COPY package*.json ./ +# Copy ONLY package.json +COPY package.json ./ # Install ONLY production dependencies -RUN npm install --omit=dev --legacy-peer-deps +RUN npm install --omit=dev # Copy the built frontend assets from the 'builder' stage COPY --from=builder /app/dist ./dist