123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- kind: pipeline
- type: docker
- name: dev
- node:
- mode: local_test
- steps:
- - name: maven
- image: maven:3.6.3-jdk-11
- volumes:
- - name: maven-cache
- path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
- commands:
- - mvn -Dmaven.test.skip=true -P dev clean package
- - name: build
- image: docker:20.10.7
- depends_on: [maven]
- volumes:
- - name: docker
- path: /var/run/docker.sock
- environment:
- IMAGE: registry.yingcaibx.com/tl/api: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 --compatibility -f docker-compose-dev.yml up -d
- trigger:
- branch:
- - dev
- event:
- - push
- volumes:
- - name: docker
- host:
- path: /var/run/docker.sock
- - name: maven-cache
- host:
- path: /data/cache/tl/api
- ---
- kind: pipeline
- type: docker
- name: pre
- node:
- mode: local_pre
- steps:
- - name: maven
- image: maven:3.6.3-jdk-11
- volumes:
- - name: maven-cache
- path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
- commands:
- - mvn -Dmaven.test.skip=true -P dev clean package
- - name: build
- image: docker:20.10.7
- depends_on: [maven]
- volumes:
- - name: docker
- path: /var/run/docker.sock
- environment:
- IMAGE: registry.yingcaibx.com/tl/api: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 --compatibility -f docker-compose-pre.yml up -d
- trigger:
- branch:
- - pre
- event:
- - push
- volumes:
- - name: docker
- host:
- path: /var/run/docker.sock
- - name: maven-cache
- host:
- path: /data/cache/tl/api
- ---
- kind: pipeline
- type: docker
- name: release
- node:
- mode: local_test
- steps:
- - name: maven
- image: maven:3.6.3-jdk-11
- volumes:
- - name: maven-cache
- path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
- commands:
- - mvn -Dmaven.test.skip=true -P dev clean package
- - name: push
- image: docker:20.10.7
- volumes:
- - name: docker
- path: /var/run/docker.sock
- environment:
- IMAGE: registry.yingcaibx.com/tl/api
- depends_on: [maven]
- 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: maven-cache
- host:
- path: /data/cache/tl/api
|