express-template/.drone.yml

101 lines
1.7 KiB
YAML

# dev环境下的docker镜像构建
kind: pipeline
type: docker
name: dev-build
node:
mode: dev
trigger:
event:
- push
branch:
- ci
steps:
- name: tag
image: alpine
pull: if-not-exists
commands:
- sh ./ci/build_tag.sh
- name: build-image
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: repo_username
password:
from_secret: repo_password
repo: docker.zcj.plus/demo/express-template
registry: https://docker.zcj.plus
---
# dev环境下的部署
kind: pipeline
type: exec
name: dev-deploy
node:
mode: ffubuntu
trigger:
event:
- push
branch:
- ci
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
steps:
- name: tag
image: alpine
pull: if-not-exists
commands:
- sh ./ci/build_tag.sh
- name: build-image
image: plugins/docker
pull: if-not-exists
settings:
username:
from_secret: repo_username
password:
from_secret: repo_password
repo: docker.zcj.plus/demo/express-template
registry: https://docker.zcj.plus