Update Dockerfile

This commit is contained in:
fcarraUniSa
2026-02-18 13:56:07 +01:00
committed by GitHub
parent 3ba1029b50
commit 157e35c9f9

View File

@@ -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;"]