一、drone编译防墙版本
1、web端drone
kind: pipeline
type: docker
name: ui
steps:- name: build_projectimage: node:20-slim depends_on: [clone]volumes:- name: node_modulespath: /drone/src/node_modulescommands:- 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_imageimage: plugins/docker:20depends_on: [build_project]# volumes:# - name: docker-sock# path: /var/run/docker.socksettings:dockerfile: Dockerfileregistry: registry.cn-beijing.aliyuncs.comrepo: registry.cn-beijing.aliyuncs.com/xxx/cp-business-webauto_tag: trueinsecure: trueusername:from_secret: docker_usernamepassword:from_secret: docker_passwordtrigger:# branch:# - mainref:- refs/tags/*- refs/heads/mastervolumes:- name: go_cachehost:path: /root/.go/cache
2、详解
1、name
2、step 编译步骤
第一个 image,
image: node:20-slim
这里需要你找到开源的镜像
这里
commands
一定要加上中国的镜像源
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