- 添加缓存依赖步骤,提高构建效率 - 使用 pnpm 替代 npm 安装依赖,减小安装体积 - 增加构建步骤,确保代码在构建前完成编译 - 更新 Docker 镜像地址,使用自定义仓库 - 添加自动打标签功能,简化版本管理
This commit is contained in:
parent
fde413dcb2
commit
b31cc6eb79
31
.drone.yml
31
.drone.yml
@ -9,16 +9,45 @@ steps:
|
||||
- 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 automated_api:latest
|
||||
- docker run -d -p 8001:8001 your-docker-repo/automated_api:latest
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
|
Loading…
Reference in New Issue
Block a user