FROM node:20-slim AS build WORKDIR /app # Install dependencies COPY package.json package-lock.json ./ RUN npm ci # Copy source and build COPY . . RUN npm run build # Runtime stage: serve static files with nginx FROM nginx:stable-alpine AS runtime # Copy built assets from build stage COPY --from=build /app/dist /usr/share/nginx/html/dist COPY --from=build /app/css /usr/share/nginx/html/css COPY --from=build /app/js /usr/share/nginx/html/js COPY --from=build /app/plugin /usr/share/nginx/html/plugin COPY --from=build /app/index.html /usr/share/nginx/html/index.html COPY --from=build /app/demo.html /usr/share/nginx/html/demo.html COPY --from=build /app/public /usr/share/nginx/html/public EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]
Concerns: Build stage expects output in /app/dist and other assets; if npm run build outputs to a different path, COPY steps will fail., Copying /app/index.html into /usr/share/nginx/html/index.html and /app/dist into /usr/share/nginx/html/dist may be redundant if build already copies index.html to dist., No HEALTHCHECK defined to detect runtime health (could be added). Smoke [PASS]: test -f /usr/share/nginx/html/index.html Smoke [PASS]: test -d /usr/share/nginx/html/dist Smoke [PASS]: test -d /usr/share/nginx/html/css && test -d /usr/share/nginx/html/js && test -d /usr/share/nginx/html/plugin