79613255

Date: 2025-05-08 22:35:45
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Blacklisted phrase (0.5): I cannot
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): Why not the
  • Low reputation (0.5):
Posted by: hongkail