You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.6 KiB
78 lines
1.6 KiB
kind: pipeline |
|
type: docker |
|
name: drone-dev-db-bastion-vue |
|
|
|
# 触发器 |
|
trigger: |
|
# 触发分支 |
|
branch: |
|
- master |
|
# 触发事件 |
|
event: |
|
- push |
|
# 事件状态 |
|
status: |
|
- success |
|
|
|
# 共享目录 |
|
volumes: |
|
- name: node-cache |
|
host: |
|
path: /data/drone/node/cache |
|
- name: node-modules |
|
host: |
|
path: /data/drone/node/node_modules |
|
- name: docker-sock |
|
host: |
|
path: /var/run/docker.sock |
|
- name: env-files |
|
host: |
|
path: /niushuai233/env |
|
|
|
# ci 步骤 |
|
steps: |
|
# node install |
|
- name: node-package |
|
image: niushuai233/node-cnpm:18.12.1 |
|
volumes: |
|
- name: node-cache |
|
path: /node_cache |
|
- name: node-modules |
|
path: /drone/src/node_modules |
|
commands: |
|
- echo 'node package start' |
|
- pwd |
|
- ls -alh |
|
- ls -alh node_modules |
|
# 打包 |
|
- npm config set registry https://registry.npm.taobao.org |
|
- npm config set cache /node_cache --global |
|
- npm run pre |
|
- npm run build |
|
|
|
# 构建镜像 |
|
- name: build-image |
|
image: docker:dind |
|
volumes: |
|
- name: docker-sock |
|
path: /var/run/docker.sock |
|
commands: |
|
- echo 'build image start' |
|
# 构建新镜像 |
|
- docker build -t niushuai233/db-bastion-vue:latest . |
|
# 清理无用镜像 |
|
- docker image prune -f --filter "dangling=true" |
|
|
|
# 启动服务 |
|
- name: deploy |
|
image: docker:dind |
|
volumes: |
|
- name: docker-sock |
|
path: /var/run/docker.sock |
|
- name: env-files |
|
path: /niushuai233/env |
|
commands: |
|
- echo 'deploy start' |
|
- pwd |
|
- ls -alh |
|
- sh deploy.sh |