22 lines
696 B
Docker
22 lines
696 B
Docker
# FASE 1: Build
|
|
FROM node:lts-alpine as build-stage
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# --- DEBUG ---
|
|
# Questo comando stampa nei log cosa c'è nella cartella /app
|
|
RUN echo "CONTENUTO DELLA CARTELLA /app:" && ls -la /app
|
|
# Questo comando stampa cosa c'è nella cartella di output (dist)
|
|
# Se la build crea una cartella diversa, qui vedremo l'errore o l'elenco vuoto
|
|
RUN echo "CONTENUTO DI /app/dist:" && ls -la /app/dist
|
|
# -------------
|
|
|
|
# FASE 2: Produzione
|
|
FROM nginx:stable-alpine as production-stage
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"] |