# Esta imagen es multi-stage, es decir, # se buildea en un contenedor transitorio, y luego se hace otro contenedor que sirva la app. # Esto para que la imagen sea más liviana y no incluya nada más que el build de producción y nginx FROM node:14-alpine AS builder ENV NODE_ENV production # Add a work directory WORKDIR /app # Cache and Install dependencies COPY package.json . # COPY package-lock.json . RUN npm install --production # Copy app files COPY . . # Build the app RUN npm run build # Bundle static assets with nginx FROM nginx:1.21.0-alpine as production ENV NODE_ENV production # Copy built assets from builder COPY --from=builder /app/build /usr/share/nginx/html # Add your nginx.conf COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]