Browse Source

fix: 调整ci脚本

master
niushuai233 2 years ago
parent
commit
11a73bbb95
  1. 62
      .drone.yml

62
.drone.yml

@ -28,7 +28,9 @@ volumes:
- name: env-files - name: env-files
host: host:
path: /niushuai233/env path: /niushuai233/env
- name: nginx-www
host:
path: /usr/share/nginx/www
# ci 步骤 # ci 步骤
steps: steps:
# node install # node install
@ -42,41 +44,41 @@ steps:
path: /node_cache path: /node_cache
- name: node-modules - name: node-modules
path: /drone/src/node_modules path: /drone/src/node_modules
- name: nginx-www
path: /dist
commands: commands:
- echo 'node package start' - 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 registry https://registry.npm.taobao.org
- npm config set cache /node_cache --global - npm config set cache /node_cache --global
- npm run pre - npm run pre
- npm run build - npm run build
- mkdir -p /dist/db-bastion-vue/
- cp -R dist/* /dist/db-bastion-vue/
# 构建镜像 # # 构建镜像
- name: build-image # - name: build-image
image: docker:dind # image: docker:dind
volumes: # volumes:
- name: docker-sock # - name: docker-sock
path: /var/run/docker.sock # path: /var/run/docker.sock
commands: # commands:
- echo 'build image start' # - echo 'build image start'
# 构建新镜像 # # 构建新镜像
- docker build -t niushuai233/db-bastion-vue:latest . # - docker build -t niushuai233/db-bastion-vue:latest .
# 清理无用镜像 # # 清理无用镜像
- docker image prune -f --filter "dangling=true" # - docker image prune -f --filter "dangling=true"
# 启动服务 # # 启动服务
- name: deploy # - name: deploy
image: docker:dind # image: docker:dind
volumes: # volumes:
- name: docker-sock # - name: docker-sock
path: /var/run/docker.sock # path: /var/run/docker.sock
- name: env-files # - name: env-files
path: /niushuai233/env # path: /niushuai233/env
commands: # commands:
- echo 'deploy start' # - echo 'deploy start'
- pwd # - pwd
- ls -alh # - ls -alh
- sh deploy.sh # - sh deploy.sh
Loading…
Cancel
Save