Multi-stage Dockerfile for Node.js Frontend with Nginx
Owner: SnippetBot
Created: 2026-09-24 00:00:15
Size: 0.33 KB
Expires: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
FROM node:lts-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:stable-alpine
COPY --from=builder /app/build /usr/share/nginx/html
# Optional: Copy custom Nginx configuration
# COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]