ci(drone): 优化 Drone构建流程
- 重构构建步骤,提高流程清晰度 - 添加文件存在性检查和错误处理,增强构建鲁棒性 - 优化目录结构创建方式 - 更新 Docker 镜像构建步骤 - 调整 Docker Compose 文件处理方式 - 移除未使用的触发配置
This commit is contained in:
parent
a8c3996cfa
commit
fb6853f57c
31
.drone.yml
31
.drone.yml
|
@ -12,21 +12,26 @@ steps:
|
|||
- name: build-output
|
||||
path: /home/app/build
|
||||
commands:
|
||||
- cd /drone/src
|
||||
- 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
|
||||
- name: copy-jars
|
||||
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
|
||||
- mkdir -p /home/app/build/gateway
|
||||
- mkdir -p /home/app/build/system
|
||||
- mkdir -p /home/app/build/infra
|
||||
- ls -l yudao-gateway/target/ # 检查源文件是否存在
|
||||
- cp yudao-gateway/target/yudao-gateway.jar /home/app/build/gateway/app.jar || echo "Failed to copy gateway jar"
|
||||
- cp yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /home/app/build/system/app.jar || echo "Failed to copy system biz jar"
|
||||
- cp yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /home/app/build/infra/app.jar || echo "Failed to copy infra biz jar"
|
||||
- cp Dockerfile /home/app/build/
|
||||
- cp docker-compose.yml /home/app/build/
|
||||
|
||||
- name: build-docker
|
||||
- name: build-docker-images
|
||||
image: docker
|
||||
volumes:
|
||||
- name: build-output
|
||||
|
@ -50,20 +55,16 @@ steps:
|
|||
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
|
||||
- sed -i "s/${APP_VERSION}/${APP_VERSION}/g" docker-compose.yml
|
||||
- docker-compose -f docker-compose.yml up -d
|
||||
|
||||
volumes:
|
||||
- name: maven-cache
|
||||
host:
|
||||
path: /home/data/maven/cache
|
||||
- name: build-output
|
||||
host:
|
||||
path: /home/data/maven/build
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
#trigger:
|
||||
# event:
|
||||
# - custom
|
||||
# ref:
|
||||
# - refs/tags/version1.1
|
||||
|
|
Loading…
Reference in New Issue