
Some checks failed
continuous-integration/drone/push Build is failing
- 添加缓存依赖步骤,提高构建效率 - 使用 pnpm 替代 npm 安装依赖,减小安装体积 - 增加构建步骤,确保代码在构建前完成编译 - 更新 Docker 镜像地址,使用自定义仓库 - 添加自动打标签功能,简化版本管理
56 lines
1.0 KiB
YAML
56 lines
1.0 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
- name: git-clone
|
|
image: alpine/git
|
|
commands:
|
|
- git clone http://120.48.5.80:3000/lixin/automated_api.git
|
|
- cd automated_api
|
|
|
|
- name: cache-dependencies
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
restore: true
|
|
mount:
|
|
- ./node_modules
|
|
- ./pnpm-lock.yaml
|
|
|
|
- name: install-dependencies
|
|
image: node:22-alpine
|
|
commands:
|
|
- apk add --no-cache pnpm
|
|
- pnpm install --production
|
|
|
|
- name: cache-dependencies-post
|
|
image: drillster/drone-volume-cache
|
|
settings:
|
|
rebuild: true
|
|
mount:
|
|
- ./node_modules
|
|
- ./pnpm-lock.yaml
|
|
|
|
- name: build
|
|
image: node:22-alpine
|
|
commands:
|
|
- pnpm run build
|
|
|
|
- name: docker-build
|
|
image: plugins/docker
|
|
settings:
|
|
dockerfile: Dockerfile
|
|
repo: your-docker-repo/automated_api
|
|
tags: latest
|
|
auto_tag: true
|
|
|
|
- name: docker-run
|
|
image: docker:20.10
|
|
commands:
|
|
- docker run -d -p 8001:8001 your-docker-repo/automated_api:latest
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push |