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)
FROM node:20 AS build
# 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
# Copia solo il file delle dipendenze
COPY package.json ./
# Pulisce la cache di npm e installa le dipendenze
# --legacy-peer-deps risolve conflitti di versioni comuni
# --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
# Install dependencies without lockfile to avoid conflicts
RUN npm install
# Copia il codice sorgente
COPY . .
# Esegue la build di Vite
# Build the app
RUN npm run build
# Stage di produzione con Nginx
# Production Stage
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html