11name : " Docker Push"
2- description : " Builds and pushes a Docker image with specified tags"
2+ description : " Builds and pushes a Docker image with specified tags, or pulls from source registry and re-tags "
33inputs :
44 version_tag :
55 description : " The primary version tag for the image (e.g., 1.0.0)"
@@ -14,6 +14,14 @@ inputs:
1414 docker_password :
1515 description : " Docker Hub password"
1616 required : true
17+ source_registry :
18+ description : " Source registry to pull from (e.g., ECR). If provided, will pull and re-tag instead of building"
19+ required : false
20+ default : " "
21+ source_image_tag :
22+ description : " Source image tag to pull (without platform suffix). Required if source_registry is provided"
23+ required : false
24+ default : " "
1725
1826runs :
1927 using : " composite"
4250 echo "TAGS_LIST=$tags" >> $GITHUB_OUTPUT
4351 echo "Prepared tags: $tags"
4452
53+ - name : Pull from Source and Push to DockerHub
54+ if : inputs.source_registry != ''
55+ shell : bash
56+ run : |
57+ source_image="${{ inputs.source_registry }}/solace-agent-mesh:${{ inputs.source_image_tag }}"
58+
59+ echo "Pulling multi-platform image from ECR: ${source_image}"
60+
61+ # Pull the multi-platform manifest and both platform images
62+ docker pull --platform linux/amd64 "${source_image}-amd64"
63+ docker pull --platform linux/arm64 "${source_image}-arm64"
64+
65+ # Convert comma-separated tags to array
66+ IFS=',' read -ra TAGS <<< "${{ steps.docker_tags.outputs.TAGS_LIST }}"
67+
68+ # For each target tag, create a multi-platform manifest
69+ for TAG in "${TAGS[@]}"; do
70+ TAG=$(echo "$TAG" | xargs) # Trim whitespace
71+ echo "Creating multi-platform manifest for: ${TAG}"
72+
73+ # Tag the platform-specific images for DockerHub
74+ docker tag "${source_image}-amd64" "${TAG}-amd64"
75+ docker tag "${source_image}-arm64" "${TAG}-arm64"
76+
77+ # Push platform-specific images
78+ docker push "${TAG}-amd64"
79+ docker push "${TAG}-arm64"
80+
81+ # Create and push multi-platform manifest
82+ docker buildx imagetools create \
83+ --tag "${TAG}" \
84+ "${TAG}-amd64" \
85+ "${TAG}-arm64"
86+ done
87+
88+ echo "Successfully pulled from ECR and pushed to DockerHub"
89+
4590 - name : Build And Push Docker Image
91+ if : inputs.source_registry == ''
4692 uses : docker/build-push-action@v6.16.0
4793 with :
4894 context : " ."
0 commit comments