feat: Add Dockerfile for multi-stage Node.js build with Nginx and .dockerignore.

This commit is contained in:
2025-12-16 00:06:26 +00:00
parent 8af2ce6941
commit e106ee9df1
2 changed files with 27 additions and 0 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
node_modules
dist
.git
.gitignore
*.log
docker-compose.yml
Dockerfile
.dockerignore

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
# Stage 1: Build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Stage 2: Serve
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]