Skip to content

Commit 68b0aff

Browse files
committed
Fix: Use Taobao npm mirror for reliable builds
1 parent 2a35697 commit 68b0aff

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ FROM node:20-alpine AS builder
33

44
WORKDIR /app
55

6+
# 使用淘宝镜像加速
7+
RUN npm config set registry https://registry.npmmirror.com
8+
69
# 复制 package.json
710
COPY backend/package*.json ./backend/
811
COPY frontend/package*.json ./frontend/
912

10-
# 安装依赖
13+
# 安装后端依赖
1114
WORKDIR /app/backend
12-
RUN npm install --production
15+
RUN npm install --omit=dev
1316

17+
# 安装前端依赖
1418
WORKDIR /app/frontend
1519
RUN npm install
1620

@@ -31,7 +35,7 @@ RUN apk add --no-cache wget
3135

3236
WORKDIR /app
3337

34-
# 复制后端
38+
# 复制后端(包括 node_modules)
3539
COPY --from=builder /app/backend /app/backend
3640

3741
# 复制前端构建产物

0 commit comments

Comments
 (0)