-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (25 loc) · 726 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (25 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ===============================================
# BUILD STAGE
# ===============================================
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
# Build both backend + frontend
RUN npm run build
# ===============================================
# PRODUCTION STAGE
# ===============================================
FROM node:20-alpine
WORKDIR /app
# Copy only needed files
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/dist-server ./dist-server
# Install only production deps
RUN npm install --omit=dev
EXPOSE 3000
ENV NODE_ENV=production
# Run compiled server
CMD ["node", "dist-server/server.js"]