# 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 ARG REACT_APP_API_URL ENV NODE_ENV production # Copy app files COPY . /app # Add a work directory WORKDIR /app # COPY package-lock.json . RUN npm install --production # Build the app ENV REACT_APP_API_URL=${REACT_APP_API_URL} 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;"]