Why not the following Dockerfile:
# Build stage
FROM node:alpine AS builder
WORKDIR /usr/src/app
COPY package.json package-lock.json* ./
RUN npm install --save-dev @types/node
COPY . .
RUN npm run build
# Production stage
FROM node:alpine
WORKDIR /usr/src/app
RUN npm install -g serve
COPY --from=builder /usr/src/app/dist ./dist
EXPOSE 80
CMD ["serve", "-s", "dist", "-l", "80"]
For some reason I cannot use nginx solution above. Not sure if it is because I am using nginx as another docker to orchestrate many dockers to work together. I use npm serve function. Not sure what is the downside. Would love to hear any comment from you.