一、drone编译防墙版本
1、web端drone
yaml
kind: pipeline
type: docker
name: ui
steps:
- name: build_project
image: node:20-slim
depends_on: [clone]
volumes:
- name: node_modules
path: /drone/src/node_modules
commands:
- pwd
- du -sh *
- npm config set registry https://registry.npmmirror.com
- npm install -g pnpm || npm install -g pnpm || npm install -g pnpm # Retry logic
- pnpm config set store-dir /drone/src/node_modules/.pnpm-store
- pnpm install || pnpm install || pnpm install # Retry logic
- npm run build
- du -sh *
- name: build_image
image: plugins/docker:20
depends_on: [build_project]
# volumes:
# - name: docker-sock
# path: /var/run/docker.sock
settings:
dockerfile: Dockerfile
registry: registry.cn-beijing.aliyuncs.com
repo: registry.cn-beijing.aliyuncs.com/xxx/cp-business-web
auto_tag: true
insecure: true
username:
from_secret: docker_username
password:
from_secret: docker_password
trigger:
# branch:
# - main
ref:
- refs/tags/*
- refs/heads/master
volumes:
- name: go_cache
host:
path: /root/.go/cache
2、详解
1、name
2、step 编译步骤
第一个 image,
image: node:20-slim
这里需要你找到开源的镜像
这里commands
一定要加上中国的镜像源
yaml
commands:
- pwd
- du -sh *
- npm config set registry https://registry.npmmirror.com
- npm install -g pnpm || npm install -g pnpm || npm install -g pnpm # Retry logic
- pnpm config set store-dir /drone/src/node_modules/.pnpm-store
- pnpm install || pnpm install || pnpm install # Retry logic
- npm run build
- du -sh *
这里是重要的防墙处理如果不处理 则npm 一安装就报错
3、各种报错如下
二、drone 讲解请参考如下:
https://ctraplatform.blog.csdn.net/article/details/130003341