Update Dockerfile

This commit is contained in:
fcarraUniSa
2026-02-18 13:56:25 +01:00
committed by GitHub
parent 157e35c9f9
commit 760a9c5340

View File

@@ -1,24 +1,22 @@
# Usa l'immagine completa di Node 20 per evitare errori di compilazione (gyp/libs mancanti) # Build Stage
FROM node:20 AS build FROM node:20-alpine AS build
# Install dependencies for native modules if needed
RUN apk add --no-cache python3 make g++
WORKDIR /app WORKDIR /app
# Copia solo il file delle dipendenze
COPY package.json ./ COPY package.json ./
# Pulisce la cache di npm e installa le dipendenze # Install dependencies without lockfile to avoid conflicts
# --legacy-peer-deps risolve conflitti di versioni comuni RUN npm install
# --no-audit e --no-fund velocizzano il processo
RUN npm cache clean --force && \
npm install --no-package-lock --legacy-peer-deps --no-audit --no-fund
# Copia il codice sorgente
COPY . . COPY . .
# Esegue la build di Vite # Build the app
RUN npm run build RUN npm run build
# Stage di produzione con Nginx # Production Stage
FROM nginx:alpine FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html