From d4bfbad3b31b66a561a03272d875769281ae17a1 Mon Sep 17 00:00:00 2001 From: LinMoQC <2896311434@qq.com> Date: Sun, 26 Apr 2026 01:41:49 +0800 Subject: [PATCH] :ambulance: fix(web): include workspace packages in docker build --- apps/web/Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index e45a769..193852e 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -13,8 +13,11 @@ WORKDIR /app # 根配置 COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ -# 只复制 web 包声明(减少依赖安装范围) +# 复制 web 与其 workspace 依赖的包声明,确保 pnpm 能解析本地 workspace 链接 COPY apps/web/package.json ./apps/web/ +COPY packages/api-client/package.json ./packages/api-client/ +COPY packages/types/package.json ./packages/types/ +COPY packages/ui/package.json ./packages/ui/ # Hoisted node_modules so Next standalone output has real files (pnpm symlinks break in runner). RUN printf '%s\n' 'node-linker=hoisted' > .npmrc @@ -35,8 +38,11 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules -# 拷贝源码 +# 拷贝 web 与其 workspace 依赖源码,保证 node_modules 中的 workspace 链接有真实目标 COPY apps/web ./apps/web +COPY packages/api-client ./packages/api-client +COPY packages/types ./packages/types +COPY packages/ui ./packages/ui # 构建参数 ARG NEXT_PUBLIC_API_BASE_URL=/api/v1 @@ -68,4 +74,4 @@ COPY --from=builder /app/apps/web/public ./apps/web/public EXPOSE 3000 # Monorepo standalone: server.js lives under apps/web(与 outputFileTracingRoot 一致) -CMD ["node", "apps/web/server.js"] \ No newline at end of file +CMD ["node", "apps/web/server.js"]