2026-10-25 23:46:37 +01:00
|
|
|
# BUILD
|
|
|
|
|
FROM node:20-alpine AS builder
|
|
|
|
|
|
2026-10-26 00:22:57 +01:00
|
|
|
WORKDIR /root/andreavillari
|
2026-10-25 23:46:37 +01:00
|
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
RUN npm install
|
|
|
|
|
|
2026-10-25 23:54:52 +01:00
|
|
|
# Copia del codice sorgente
|
2026-10-25 23:46:37 +01:00
|
|
|
COPY . .
|
2026-10-25 23:54:52 +01:00
|
|
|
|
|
|
|
|
# Impostazioni limite meoria Node.js
|
|
|
|
|
ENV NODE_OPTIONS:"--max-old-space-size=768"
|
|
|
|
|
|
|
|
|
|
# Esexuzione della build (verifica che nel package.json ci sia "build")
|
2026-10-25 23:46:37 +01:00
|
|
|
RUN npm run builder
|
|
|
|
|
|
2026-10-25 23:54:52 +01:00
|
|
|
#PRODUCTION (standalone)
|
|
|
|
|
|
|
|
|
|
# --- STAGE 2 : Production (Serve file statici con Nginx)---
|
|
|
|
|
FROM nginx:alpine
|
2026-10-26 00:57:06 +01:00
|
|
|
COPY --from=builder /root/andreavillari/dist /usr/share/nginx/html
|
2026-10-25 23:46:37 +01:00
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
CMD ["nginx","-g","daemon off;"]
|