FROM public.ecr.aws/docker/library/node:16 as builder WORKDIR /app COPY . . RUN npm ci RUN npm run build # Using multi-stage build, take only static web assets and place them in a nginx container # Bundle static assets with nginx FROM nginx:1.23.2-alpine as production # Copy built assets from `builder` image COPY --from=builder /app/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 # Start nginx CMD ["nginx", "-g", "daemon off;"]
nginx.conf
server { listen 80; location / { root /usr/share/nginx/html/; include /etc/nginx/mime.types; try_files $uri $uri/ /index.html; } }
Top comments (0)