kind: pipeline name: linear-wctdreamwebsite-front-pipeline platform: os: linux arch: amd64 workspace: path: /drone/src trigger: branch: - master event: - push image_pull_secrets: - docker_auth_config volumes: - name: cache host: path: /tmp/cache steps: #加载缓存node_modules - name: restore-cache image: sinlead/drone-cache:1.0.0 volumes: - name: cache path: /cache settings: action: load key: package-lock.json mount: node_modules prefix: npm-modules-v1 when: event: [ push ] branch: [ master ] #安装缓存 - name: install-cache image: node:16 commands: - CI=false - echo 'nuxt项目 build 缓存安装' - npm config set registry https://registry.npm.taobao.org - npm config set disturl https://npm.taobao.org/dist - npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ - npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ - npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ - npm install cnpm -g # - npm cache clear --force - npm install - cnpm install when: event: [ push, pull_request ] branch: [ master ] - name: rebuild-cache image: sinlead/drone-cache:1.0.0 rebuild: true volumes: - name: cache path: /cache settings: action: save key: package-lock.json mount: node_modules prefix: npm-modules-v1 when: event: [ push ] branch: [ master ] - name: build image: node:16 commands: - CI=false - echo 'nuxt项目 build 打包部署' - npm config set registry https://registry.npm.taobao.org - npm config set disturl https://npm.taobao.org/dist - npm config set electron_mirror https://npm.taobao.org/mirrors/electron/ - npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ - npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ - npm install cnpm -g - npm install - cnpm install - npm run build - mkdir source - mv .nuxt static nuxt.config.js package.json package-lock.json docker-compose.yml Dockerfile source - ls -al source when: status: [ success ] - name: deploy image: drillster/drone-rsync settings: hosts: - 47.101.128.186 user: root prot: 22 key: from_secret: SSH_KEY source: ./source/ target: /wwwroot/wctdreamwebsite-front include: [] exclude: [] script: - cd /wwwroot/wctdreamwebsite-front - ls -al - docker-compose down - docker-compose up --build -d - docker ps | grep wctdreamwebsite-front when: status: [ success ]