
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
npm test)npm run build)npm publish,需配置认证信息)原生 npm 命令支持
直接集成 npm 工具链,支持执行任意 npm 命令(如 install、test、run <script> 等),兼容标准 npm 脚本语法。
Drone 环境集成
自动读取 Drone 流水线上下文信息(如环境变量、工作目录),无需额外配置即可适配流水线环境。
灵活的参数配置
支持自定义命令参数、工作目录、npm 镜像源(registry)及认证信息,满足私有仓库或特殊环境需求。
轻量级镜像
基于官方 Node.js 基础镜像构建,精简依赖,减少流水线执行时间和资源占用。
npm install 安装依赖后执行 npm run build 生成静态资源。npm test 执行单元测试、E2E 测试或代码 lint(如 ESLint),确保代码质量。npm publish 自动发布包至 npm 仓库(需配置 NPM_TOKEN 等认证信息)。package.json 文件(定义 npm 脚本和依赖)。drone-npm 作为 Drone 插件,需在流水线配置文件(通常为 .drone.yml)中定义步骤,通过 image: plugins/npm 指定镜像,并配置 settings 字段定义具体行为。
示例 1:安装依赖并运行测试
在流水线中执行 npm install 安装依赖,随后通过 npm test 运行测试脚本:
yamlkind: pipeline type: docker name: default steps: - name: npm-test image: plugins/npm settings: command: test # 等效于执行 `npm test` # 可选:指定 npm 镜像源(如使用淘宝镜像加速国内访问) registry: https://registry.npm.taobao.org
示例 2:执行自定义构建命令
运行项目自定义脚本(如 npm run build)生成构建产物:
yamlsteps: - name: npm-build image: plugins/npm settings: command: run build # 等效于执行 `npm run build` # 可选:指定工作目录(默认为流水线工作目录) working_dir: ./frontend
示例 3:发布 npm 包至私有仓库
配置认证信息,发布包至私有 npm 仓库(需提前在 Drone 中配置 secrets,如 npm_token):
yamlsteps: - name: npm-publish image: plugins/npm settings: command: publish # 执行 `npm publish` registry: https://npm.example.com # 私有仓库地址 token: from_secret: npm_token # 从 Drone secrets 读取认证 token
| 参数名 | 类型 | 描述 | 默认值 |
|---|---|---|---|
command | string | 需执行的 npm 命令(如 install、test、run build、publish) | install |
args | string | 传递给 npm 命令的额外参数(如 --production、--force) | 无 |
working_dir | string | 执行命令的工作目录(相对于流水线工作目录) | 流水线工作目录 |
registry | string | npm 镜像源地址(如 https://registry.npmjs.org 或私有仓库) | https://registry.npmjs.org |
token | string | npm 仓库认证 token(用于 npm publish 或私有仓库访问,建议通过 secret 传递) | 无 |
username | string | npm 仓库用户名(替代 token 的认证方式,与 password 配合使用) | 无 |
password | string | npm 仓库密码(与 username 配合使用,建议通过 secret 传递) | 无 |
.drone.yml 示例yamlkind: pipeline type: docker name: frontend-ci steps: - name: install-deps image: plugins/npm settings: command: install registry: https://registry.npm.taobao.org # 使用淘宝镜像加速 - name: run-tests image: plugins/npm settings: command: test args: -- --coverage # 传递参数给测试命令(如生成覆盖率报告) - name: build image: plugins/npm settings: command: run build working_dir: ./src # 假设构建脚本在 src 目录下 - name: publish-package image: plugins/npm settings: command: publish registry: https://npm.example.com # 私有仓库 token: from_secret: npm_private_token # 从 Drone secrets 读取 token when: event: tag # 仅在标签推送时执行发布
image 字段中指定具体版本(如 plugins/npm:1.2.0),避免因镜像更新导致兼容性问题。token、password 等敏感信息时,必须通过 Drone Secrets 管理,禁止明文写入配置文件。args 中添加 --verbose(如 args: --verbose)查看 npm 详细日志,辅助定位问题。项目维护地址:https://github.com/drone-plugins/drone-npm
问题反馈:Drone Discourse 或 StackOverflow(drone.io 标签)
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




来自真实用户的反馈,见证轩辕镜像的优质服务