From 157e35c9f9beee6326293935c3173685b013ee00 Mon Sep 17 00:00:00 2001 From: fcarraUniSa Date: Wed, 18 Feb 2026 13:56:07 +0100 Subject: [PATCH] Update Dockerfile --- backend/Dockerfile | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 5fb5495..d63cad7 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,19 +1,24 @@ -# Usa l'immagine completa di Node 20 per garantire compatibilità con tutte le librerie -FROM node:20 +# Build Stage +FROM node:20-alpine AS build + +# Install dependencies for native modules if needed +RUN apk add --no-cache python3 make g++ WORKDIR /app COPY package.json ./ -# Pulisce cache e installa con flag di compatibilità -RUN npm cache clean --force && \ - npm install --no-package-lock --legacy-peer-deps --no-audit --no-fund +# Install dependencies without lockfile to avoid conflicts +RUN npm install COPY . . -# Assicura che la cartella uploads esista -RUN mkdir -p uploads +# Build the app +RUN npm run build -EXPOSE 3000 - -CMD ["npm", "start"] +# Production Stage +FROM nginx:alpine +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"]