kind: pipeline type: docker name: dev node: mode: local_test steps: - name: yarn-install image: node:18.16.1 volumes: - name: modules-cache path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载 commands: - npm install -g pnpm # - pnpm config set registry http://registry.npmjs.org # - pnpm install - pnpm run build - name: build image: docker:20.10.7 depends_on: [yarn-install] volumes: - name: docker path: /var/run/docker.sock environment: IMAGE: registry.yingcaibx.com/tl/admin_web:latest commands: # 清理 docker 服务中不再使用的镜像、挂载、网络等资源 - docker system prune --force --volumes || true - docker build -f ./Dockerfile -t $IMAGE ./ - name: run image: docker/compose depends_on: [build] volumes: - name: docker path: /var/run/docker.sock commands: - docker-compose -f docker-compose-dev.yml up -d trigger: branch: - dev event: - push volumes: - name: docker host: path: /var/run/docker.sock - name: modules-cache host: path: /data/cache/tl/new_web --- kind: pipeline type: docker name: pre node: mode: local_pre steps: - name: yarn-install image: node:18.16.1 volumes: - name: modules-cache path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载 commands: # - pnpm config set registry http://registry.npmjs.org - npm install -g pnpm # - pnpm install - pnpm run build - name: build image: docker:20.10.7 depends_on: [yarn-install] volumes: - name: docker path: /var/run/docker.sock environment: IMAGE: registry.yingcaibx.com/tl/admin_web:latest commands: # 清理 docker 服务中不再使用的镜像、挂载、网络等资源 - docker system prune --force --volumes || true - docker build -f ./Dockerfile -t $IMAGE ./ - name: run image: docker/compose depends_on: [build] volumes: - name: docker path: /var/run/docker.sock commands: - docker-compose -f docker-compose-pre.yml up -d trigger: branch: - pre event: - push volumes: - name: docker host: path: /var/run/docker.sock - name: modules-cache host: path: /data/cache/tl/web_new --- kind: pipeline type: docker name: release node: mode: local_test steps: - name: yarn-install depends_on: [clone] image: node:18.16.1 volumes: - name: modules-cache path: /drone/src/node_modules # 下载依赖的目录挂载出来,防止重复下载 commands: - npm install -g pnpm # - pnpm install - pnpm run build # - yarn install && yarn run build - name: push image: docker:20.10.7 depends_on: [yarn-install] volumes: - name: docker path: /var/run/docker.sock environment: IMAGE: registry.yingcaibx.com/tl/admin_web commands: - docker login -u yxt -p qwe123QWE registry.yingcaibx.com - echo $DRONE_TAG - docker build -f ./Dockerfile -t $IMAGE:$DRONE_TAG ./ - docker push $IMAGE:$DRONE_TAG - docker rmi $IMAGE:$DRONE_TAG trigger: event: - tag volumes: - name: docker host: path: /var/run/docker.sock - name: modules-cache host: path: /data/cache/tl/web