kind: pipeline type: docker name: venue_reservation_service steps: # 1. Maven打包阶段 - name: build java package pull: if-not-exists image: maven:3.8.7-openjdk-17-slim volumes: - name: maven-cache path: /root/.m2 - name: build-output path: /build-output commands: - mvn clean package -Dmaven.test.skip=true - cp target/*.jar /build-output/app.jar - cp Dockerfile /build-output - cp docker.sh /build-output environment: DRONE_REPO_NAME: venue_reservation_service # 确保这个变量设置正确 # 2. Docker构建和部署阶段 - name: build and deploy docker image: docker:20.10-dind volumes: - name: build-output path: /build-output - name: docker-sock path: /var/run/docker.sock commands: - cd /build-output - chmod +x docker.sh - ./docker.sh volumes: - name: build-output host: path: /home/projects/venue/build - name: maven-cache host: path: /home/projects/venue/maven/cache - name: docker-sock host: path: /var/run/docker.sock trigger: branch: - master