express-template/.drone.yml

101 lines
1.7 KiB
YAML
Raw Normal View History

2021-08-29 10:31:21 +00:00
# dev环境下的docker镜像构建
2021-06-28 05:52:36 +00:00
kind: pipeline
2021-08-16 15:47:37 +00:00
type: docker
2021-08-29 10:31:21 +00:00
name: dev-build
2021-06-28 05:52:36 +00:00
node:
2021-08-16 15:47:37 +00:00
mode: dev
2021-06-28 05:52:36 +00:00
trigger:
2021-08-16 15:47:37 +00:00
event:
2021-08-29 10:31:21 +00:00
- push
branch:
- ci
2021-08-16 15:47:37 +00:00
2021-06-28 05:52:36 +00:00
steps:
2021-08-29 10:31:21 +00:00
- name: tag
image: alpine
pull: if-not-exists
commands:
- sh ./ci/build_tag.sh
2021-08-16 15:47:37 +00:00
- name: build-image
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: repo_username
password:
from_secret: repo_password
2021-08-16 17:08:36 +00:00
repo: docker.zcj.plus/demo/express-template
2021-08-16 15:47:37 +00:00
registry: https://docker.zcj.plus
2021-06-28 05:52:36 +00:00
---
2021-08-29 10:31:21 +00:00
# dev环境下的部署
2021-06-28 05:52:36 +00:00
kind: pipeline
2021-08-29 10:31:21 +00:00
type: exec
name: dev-deploy
2021-06-28 05:52:36 +00:00
node:
2021-08-29 10:31:21 +00:00
mode: ffubuntu
2021-06-28 05:52:36 +00:00
trigger:
2021-08-16 15:47:37 +00:00
event:
- push
branch:
- ci
2021-08-29 10:31:21 +00:00
steps:
- name: serve
environment:
env:
from_secret: dev_env
commands:
- docker pull docker.zcj.plus/demo/express-template:dev
- echo -n "$env" > .env
- docker rm node-uniqid-dev-server -f || true
- docker create -it --name node-uniqid-dev-server --restart always docker.zcj.plus/demo/express-template:dev
- docker cp .env node-uniqid-dev-server:/src
- docker start node-uniqid-dev-server
- docker logs node-uniqid-dev-server
depends_on:
- "dev-build"
---
# 正式环境下的镜像构建
kind: pipeline
type: docker
name: release
node:
mode: dev
trigger:
event:
- tag
2021-08-16 15:47:37 +00:00
2021-06-28 05:52:36 +00:00
steps:
2021-08-16 15:47:37 +00:00
2021-08-29 10:31:21 +00:00
- name: tag
image: alpine
pull: if-not-exists
commands:
- sh ./ci/build_tag.sh
2021-08-16 15:47:37 +00:00
- name: build-image
2021-06-28 05:52:36 +00:00
image: plugins/docker
pull: if-not-exists
settings:
username:
2021-08-16 15:47:37 +00:00
from_secret: repo_username
2021-06-28 05:52:36 +00:00
password:
2021-08-16 15:47:37 +00:00
from_secret: repo_password
2021-08-29 10:31:21 +00:00
repo: docker.zcj.plus/demo/express-template
registry: https://docker.zcj.plus