-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (49 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
70 lines (49 loc) · 1.29 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# # #building stage
# # FROM node:20-alpine AS build
# # WORKDIR /app
# # COPY package*.json ./
# # RUN npm install
# # COPY . .
# # RUN npm run build
# # # production stage
# # FROM node:20-alpine AS production
# # WORKDIR /app
# # COPY package*.json ./
# # RUN npm install --production
# # COPY --from=build /app/dist ./dist
# # COPY .env .env
# # EXPOSE 3000
# # CMD ["node", "dist/index.js"]
# # --- Build Stage ---
# FROM node:20-alpine AS build
# WORKDIR /app
# COPY package*.json ./
# RUN npm install
# COPY . .
# RUN npm run build
# # --- Production Stage ---
# FROM node:20-alpine AS production
# WORKDIR /app
# # Copy only built files + node_modules from build stage
# COPY --from=build /app/node_modules ./node_modules
# COPY --from=build /app/dist ./dist
# COPY --from=build /app/package*.json ./
# COPY --from=build /app/.env .env
# EXPOSE 3000
# CMD ["node", "dist/server.js"]
# --- Build Stage ---
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# --- Production Stage ---
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/package*.json ./
COPY --from=build /app/.env .env
EXPOSE 3000
CMD ["node", "dist/server.js"]