修复前端构建:正确配置 BladeX 私有 npm registry
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
问题: - Dockerfile 中 npm install 时未复制 .npmrc 文件 - 使用 --registry 参数覆盖了 .npmrc 中的私有 registry 配置 - 导致无法下载 @saber scope 的私有包,报 E401 认证错误 解决方案: - Dockerfile: 在 npm install 前复制 .npmrc 文件 - Dockerfile: 移除 --registry 参数,使用 .npmrc 中的配置 - .drone.yml: 同样移除 --registry 参数 现在 npm 会正确使用: - @saber 包 -> https://center.javablade.com (私有 registry) - 其他包 -> npm 默认源 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,7 @@ steps:
|
|||||||
image: node:18-alpine
|
image: node:18-alpine
|
||||||
commands:
|
commands:
|
||||||
- echo "开始安装 npm 依赖..."
|
- echo "开始安装 npm 依赖..."
|
||||||
- npm install --registry=https://registry.npmmirror.com
|
- npm install
|
||||||
- echo "✅ 依赖安装完成"
|
- echo "✅ 依赖安装完成"
|
||||||
|
|
||||||
# 步骤2:构建生产版本
|
# 步骤2:构建生产版本
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ FROM node:18-alpine AS builder
|
|||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# 复制 package 文件
|
# 复制 package 文件和 npm 配置
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
COPY .npmrc ./
|
||||||
|
|
||||||
# 安装依赖(使用国内镜像加速)
|
# 安装依赖(.npmrc 中已配置私有 registry 和认证)
|
||||||
RUN npm install --registry=https://registry.npmmirror.com
|
RUN npm install
|
||||||
|
|
||||||
# 复制源码
|
# 复制源码
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
Reference in New Issue
Block a user