Update Dockerfile
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,22 +1,24 @@
|
||||
# Build Stage
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
# Install dependencies for native modules if needed
|
||||
RUN apk add --no-cache python3 make g++
|
||||
# Usa l'immagine Node completa (Debian-based) invece di Alpine
|
||||
# Questo risolve i problemi di librerie mancanti (glibc) per esbuild/vite
|
||||
FROM node:20 AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiamo package.json
|
||||
COPY package.json ./
|
||||
|
||||
# Install dependencies without lockfile to avoid conflicts
|
||||
RUN npm install
|
||||
# Installazione standard.
|
||||
# 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 . .
|
||||
|
||||
# Build the app
|
||||
# Eseguiamo la build
|
||||
RUN npm run build
|
||||
|
||||
# Production Stage
|
||||
# Stage di produzione
|
||||
FROM nginx:alpine
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
Reference in New Issue
Block a user