赞
踩
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
第一个 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 一安装就报错
https://ctraplatform.blog.csdn.net/article/details/130003341
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。