Update Dockerfile

This commit is contained in:
fcarraUniSa
2026-02-18 14:09:51 +01:00
committed by GitHub
parent fdd726753b
commit 16a3b0edf7

View File

@@ -1,22 +1,24 @@
# Build Stage # Usa l'immagine Node completa (Debian-based) invece di Alpine
FROM node:20-alpine AS build # Questo risolve i problemi di librerie mancanti (glibc) per esbuild/vite
FROM node:20 AS build
# Install dependencies for native modules if needed
RUN apk add --no-cache python3 make g++
WORKDIR /app WORKDIR /app
# Copiamo package.json
COPY package.json ./ COPY package.json ./
# Install dependencies without lockfile to avoid conflicts # Installazione standard.
RUN npm install # Rimuoviamo node_modules se presente per sicurezza prima di installare
RUN rm -rf node_modules package-lock.json && \
npm install
# Copiamo il resto dei file
COPY . . COPY . .
# Build the app # Eseguiamo la build
RUN npm run build RUN npm run build
# Production Stage # Stage di produzione
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