ci(.drone.yml): 重构自动化构建流程并添加部署步骤
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
- 新增 pnpm 安装和配置步骤,提高包管理效率 - 分离代码克隆、依赖安装、构建和测试步骤,提升构建清晰度 - 添加 Docker 镜像构建和部署步骤,实现持续集成和部署 - 使用临时卷存储 node_modules,优化构建性能
This commit is contained in:
parent
320ae922b0
commit
ab0f0a873a
27
.drone.yml
27
.drone.yml
@ -9,21 +9,36 @@ steps:
|
|||||||
- git clone http://120.48.5.80:3000/lixin/automated_api.git
|
- git clone http://120.48.5.80:3000/lixin/automated_api.git
|
||||||
- cd automated_api
|
- cd automated_api
|
||||||
|
|
||||||
- name: node-dowun
|
- name: setup-pnpm
|
||||||
image: node:22-alpine
|
image: node:22-alpine
|
||||||
|
commands:
|
||||||
|
- npm install -g pnpm
|
||||||
|
- pnpm config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
- name: install-deps
|
||||||
|
image: node:22-alpine
|
||||||
|
commands:
|
||||||
|
- pnpm install
|
||||||
|
volumes:
|
||||||
|
- name: node_modules
|
||||||
|
path: /app/node_modules
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: node:22-alpine
|
||||||
|
commands:
|
||||||
|
- pnpm run build
|
||||||
|
|
||||||
- name: docker-build
|
- name: docker-build
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
repo: rz/automated_api
|
||||||
|
tags: latest
|
||||||
|
|
||||||
|
|
||||||
- name: docker-run
|
|
||||||
image: docker:20.10
|
|
||||||
commands:
|
|
||||||
- docker run -d -p 8001:8001 rz/automated_api:latest
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
Loading…
Reference in New Issue
Block a user