Update Dockerfile

This commit is contained in:
fcarraUniSa
2025-12-10 12:21:36 +01:00
committed by GitHub
parent 727f9dca2c
commit 1393651043

View File

@@ -1,10 +1,10 @@
# Stage 1: Build the React Application # Stage 1: Build the React Application
FROM node:20-alpine AS builder FROM node:20-slim AS builder
WORKDIR /app WORKDIR /app
# Copy package.json to install dependencies first (better caching) # Copy package.json (and lock file if it exists) to install dependencies first
COPY package.json ./ COPY package*.json ./
# Install all dependencies (including devDependencies for the build process) # Install all dependencies (including devDependencies for the build process)
RUN npm install RUN npm install
@@ -16,12 +16,12 @@ COPY . .
RUN npm run build RUN npm run build
# Stage 2: Setup the Production Server (Node.js) # Stage 2: Setup the Production Server (Node.js)
FROM node:20-alpine FROM node:20-slim
WORKDIR /app WORKDIR /app
# Copy package.json again for production dependencies # Copy package.json again for production dependencies
COPY package.json ./ COPY package*.json ./
# Install ONLY production dependencies (skips devDependencies like Vite/Typescript) # Install ONLY production dependencies (skips devDependencies like Vite/Typescript)
RUN npm install --omit=dev RUN npm install --omit=dev