kind: pipeline type: docker name: ${serverName} # 服务名成,可与jar包名保持一致 steps: - name: maven-build image: maven:3.8.5-openjdk-17 volumes: - name: maven-cache path: /root/.m2 - name: build-output path: /home/app/build commands: - mvn clean package -DskipTests=true -pl yudao-gateway,yudao-module-system/yudao-module-system-biz,yudao-module-infra/yudao-module-infra-biz -am - name: build-jar image: alpine volumes: - name: build-output path: /home/app/build commands: - mkdir -p /home/app/build/{gateway,system,infra} - cp yudao-gateway/target/yudao-gateway.jar /home/app/build/gateway/app.jar - cp yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /home/app/build/system/app.jar - cp yudao-module-infra/yudao-module-infra-biz/target//yudao-module-infra-biz.jar /home/app/build/infra/app.jar - cp Dockerfile /home/app/build/ - name: build-docker image: docker volumes: - name: build-output path: /home/app/build - name: docker path: /var/run/docker.sock commands: - cd /home/app/build - cd gateway && docker build -t yudao-gateway:${APP_VERSION} -f ../Dockerfile . - cd ../system && docker build -t yudao-module-system:${APP_VERSION} -f ../Dockerfile . - cd ../infra && docker build -t yudao-module-infra:${APP_VERSION} -f ../Dockerfile . - name: deploy-with-compose image: docker/compose:1.29.2 environment: APP_VERSION: ${APP_VERSION} volumes: - name: build-output path: /home/app/build - name: docker path: /var/run/docker.sock commands: - cd /home/app/build - cp docker-compose.yml . - sed -i "s/\${APP_VERSION}/${APP_VERSION}/g" docker-compose.yml - docker-compose up -d volumes: - name: maven-cache host: path: /home/data/maven/cache - name: docker host: path: /var/run/docker.sock #trigger: # event: # - custom # ref: # - refs/tags/version1.1