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.
 
 
 

87 lines
1.9 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
- name: nginx-www
host:
path: /usr/share/nginx/www
# ci 步骤
steps:
# node install
- name: node-package
image: niushuai233/node-cnpm:16.17.1
environment:
PROD_API_URL:
from_secret: PROD_API_URL
volumes:
- name: node-cache
path: /node_cache
- name: node-modules
path: /drone/src/node_modules
- name: nginx-www
path: /dist
commands:
- echo 'node package start'
- ls -alh
- echo $PROD_API_URL
- sed -i "s#PROD_API_URL#$PROD_API_URL#g" .env.production
- cat .env.production
- npm config set registry https://registry.npm.taobao.org
- npm config set cache /node_cache --global
- npm run pre
- npm run build
- mkdir -p /dist/db-bastion-vue/
- cp -R dist/* /dist/db-bastion-vue/
# # 构建镜像
# - 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