[fix]:[20251208][构建docker1]

This commit is contained in:
kale 2025-12-07 22:18:43 -05:00
parent ad7f4e9672
commit 067aad30df

View File

@ -68,42 +68,34 @@ steps:
- pom.xml - pom.xml
event: [ push, pull_request, tag ] event: [ push, pull_request, tag ]
# - name: docker_build - name: docker_build
# image: docker:latest image: docker:latest
# pull: false pull: false
# volumes: volumes:
# - name: docker_sock - name: docker_sock
# path: /var/run/docker.sock path: /var/run/docker.sock
# commands: commands:
# # 验证 JAR 文件存在 # 验证 JAR 文件存在
# - | - |
# if [ ! -f target/drone-test-1.0.jar ]; then if [ ! -f target/drone-test-1.0.jar ]; then
# echo "❌ JAR file not found! Make sure java-build step completed successfully." echo "❌ JAR file not found! Make sure java-build step completed successfully."
# ls -la target/ || echo "target directory does not exist" ls -la target/ || echo "target directory does not exist"
# exit 1 exit 1
# fi fi
# # 显示构建信息 echo "📦 Building Docker image: ${DRONE_REPO_NAME}:latest"
# - echo "📦 Building Docker image with tag: drone-test:${DRONE_REPO_NAME}" echo "📁 JAR file info:"
# - echo "📁 JAR file info:" ls -lh target/drone-test-1.0.jar
# - ls -lh target/drone-test-1.0.jar docker build -t ${DRONE_REPO_NAME}:latest -f Dockerfile .
# # 构建 Docker 镜像 docker tag ${DRONE_REPO_NAME}:latest ${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA:0:8}
# - docker build -t drone-test:${DRONE_REPO_NAME} -f Dockerfile . echo "✅ Built Docker image: ${DRONE_REPO_NAME}:latest"
# # 如果存在 DRONE_TAG同时打 latest 标签 docker images ${DRONE_REPO_NAME}
# - | depends_on:
# if [ -n "${DRONE_TAG}" ]; then - java-build
# docker tag drone-test:${DRONE_REPO_NAME} drone-test:latest when:
# echo "✅ Tagged as drone-test:latest" path:
# fi include:
# - echo "✅ Built Docker image: drone-test:${DRONE_REPO_NAME}" - pom.xml
# # 显示镜像信息 event: [ push, pull_request, tag ]
# - docker images drone-test
# depends_on:
# - java-build
# when:
# path:
# include:
# - pom.xml
# event: [ push, pull_request, tag ]
# 自动检测是否存在 Python (requirements.txt) # 自动检测是否存在 Python (requirements.txt)
- name: python-test - name: python-test