fix(docker): 配置 npm 镜像源解决网络访问问题
- 配置 npm registry 为 https://registry.npmmirror.com - 解决 Corepack 下载 pnpm 超时问题 - 配置 pnpm registry 加速依赖安装 - 应用于所有 stage (deps, prod-deps)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# Base stage: Install dependencies
|
||||
# ============================================
|
||||
FROM harbor.tegical.world/docker.io/node:24.11.1-alpine AS base
|
||||
# 配置 npm 镜像源用于 Corepack 下载 pnpm
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN corepack enable
|
||||
WORKDIR /app
|
||||
|
||||
@@ -15,6 +17,8 @@ COPY apps/api/prisma ./apps/api/prisma/
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY packages/eslint-config/package.json ./packages/eslint-config/
|
||||
COPY packages/typescript-config/package.json ./packages/typescript-config/
|
||||
# 配置 pnpm 镜像源
|
||||
RUN pnpm config set registry https://registry.npmmirror.com
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Generate Prisma Client
|
||||
@@ -48,6 +52,8 @@ COPY apps/api/prisma ./apps/api/prisma/
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY packages/eslint-config/package.json ./packages/eslint-config/
|
||||
COPY packages/typescript-config/package.json ./packages/typescript-config/
|
||||
# 配置 pnpm 镜像源
|
||||
RUN pnpm config set registry https://registry.npmmirror.com
|
||||
RUN pnpm install --frozen-lockfile --prod
|
||||
|
||||
# Generate Prisma Client for production
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
# Base stage: Install dependencies
|
||||
# ============================================
|
||||
FROM harbor.tegical.world/docker.io/node:24.11.1-alpine AS base
|
||||
# 配置 npm 镜像源用于 Corepack 下载 pnpm
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
RUN corepack enable
|
||||
WORKDIR /app
|
||||
|
||||
@@ -14,6 +16,8 @@ COPY apps/web/package.json ./apps/web/
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
COPY packages/eslint-config/package.json ./packages/eslint-config/
|
||||
COPY packages/typescript-config/package.json ./packages/typescript-config/
|
||||
# 配置 pnpm 镜像源
|
||||
RUN pnpm config set registry https://registry.npmmirror.com
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# ============================================
|
||||
|
||||
Reference in New Issue
Block a user