Update Dockerfile
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,24 +1,22 @@
|
|||||||
# Usa l'immagine completa di Node 20 per evitare errori di compilazione (gyp/libs mancanti)
|
# Build Stage
|
||||||
FROM node:20 AS build
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
|
# Install dependencies for native modules if needed
|
||||||
|
RUN apk add --no-cache python3 make g++
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copia solo il file delle dipendenze
|
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
|
|
||||||
# Pulisce la cache di npm e installa le dipendenze
|
# Install dependencies without lockfile to avoid conflicts
|
||||||
# --legacy-peer-deps risolve conflitti di versioni comuni
|
RUN npm install
|
||||||
# --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
|
|
||||||
|
|
||||||
# Copia il codice sorgente
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Esegue la build di Vite
|
# Build the app
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Stage di produzione con Nginx
|
# Production Stage
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user