@@ -91,11 +91,23 @@ jobs:
9191 with :
9292 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
9393
94- - name : Build and push Docker image
94+ # Build and export wheels directly (fastest method)
95+ - name : Build and export wheels
96+ uses : docker/build-push-action@v5
97+ with :
98+ context : .
99+ target : wheels # We'll add this target to Dockerfile
100+ outputs : type=local,dest=./out
101+ cache-from : type=local,src=/tmp/.buildx-cache
102+ cache-to : type=local,dest=/tmp/.buildx-cache,mode=max
103+
104+ # Build and push the complete image (main stage)
105+ - name : Build and push Docker image
95106 id : build-and-push
96107 uses : docker/build-push-action@v5
97108 with :
98109 context : .
110+ target : main # 构建主阶段(完整可用镜像)
99111 push : ${{ github.event_name != 'pull_request' }}
100112 tags : ${{ steps.meta.outputs.tags }}
101113 labels : ${{ steps.meta.outputs.labels }}
@@ -109,16 +121,11 @@ jobs:
109121 DIGEST : ${{ steps.build-and-push.outputs.digest }}
110122 run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
111123
112- - name : Export wheel from image
124+ - name : Verify exported wheels
113125 run : |
114- CONTAINER_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
115- CONTAINER_ID=$(docker create $CONTAINER_TAG)
116- # Copy wheel files from the container to the local machine
117- docker cp "$CONTAINER_ID:/out" ./out
118- # Remove the container
119- docker rm "$CONTAINER_ID"
120- # Verify wheel file has been copied
121- ls ./out
126+ echo "Wheel files exported directly during build:"
127+ ls -la ./out/
128+ echo "Wheel count: $(ls -1 ./out/*.whl | wc -l)"
122129
123130 - name : Upload .whl to GitHub Release
124131 if : startsWith(github.ref, 'refs/tags/')
0 commit comments