We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a35697 commit 68b0affCopy full SHA for 68b0aff
1 file changed
Dockerfile
@@ -3,14 +3,18 @@ FROM node:20-alpine AS builder
3
4
WORKDIR /app
5
6
+# 使用淘宝镜像加速
7
+RUN npm config set registry https://registry.npmmirror.com
8
+
9
# 复制 package.json
10
COPY backend/package*.json ./backend/
11
COPY frontend/package*.json ./frontend/
12
-# 安装依赖
13
+# 安装后端依赖
14
WORKDIR /app/backend
-RUN npm install --production
15
+RUN npm install --omit=dev
16
17
+# 安装前端依赖
18
WORKDIR /app/frontend
19
RUN npm install
20
@@ -31,7 +35,7 @@ RUN apk add --no-cache wget
31
35
32
36
33
37
34
-# 复制后端
38
+# 复制后端(包括 node_modules)
39
COPY --from=builder /app/backend /app/backend
40
41
# 复制前端构建产物
0 commit comments