Update Dockerfile
This commit is contained in:
@@ -1,19 +1,24 @@
|
|||||||
# Usa l'immagine completa di Node 20 per garantire compatibilità con tutte le librerie
|
# Build Stage
|
||||||
FROM node:20
|
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
|
||||||
|
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
|
|
||||||
# Pulisce cache e installa con flag di compatibilità
|
# Install dependencies without lockfile to avoid conflicts
|
||||||
RUN npm cache clean --force && \
|
RUN npm install
|
||||||
npm install --no-package-lock --legacy-peer-deps --no-audit --no-fund
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Assicura che la cartella uploads esista
|
# Build the app
|
||||||
RUN mkdir -p uploads
|
RUN npm run build
|
||||||
|
|
||||||
EXPOSE 3000
|
# Production Stage
|
||||||
|
FROM nginx:alpine
|
||||||
CMD ["npm", "start"]
|
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;"]
|
||||||
|
|||||||
Reference in New Issue
Block a user