feat: add composite action to build and push multi-arch images via remote Docker builder

This commit is contained in:
2026-07-10 18:14:43 -03:00
parent ea92f3e55d
commit 740cbef5c1

View File

@@ -81,6 +81,26 @@ runs:
docker context use remote-builder
docker buildx inspect --bootstrap
- name: Generate tags list
id: gentags
shell: bash
env:
IMAGE: ${{ inputs.image }}
IMAGE_TAGS: ${{ inputs.image_tag }}
run: |
TAGS_LIST=""
IFS=',' read -ra ADDR <<< "${IMAGE_TAGS}"
for tag in "${ADDR[@]}"; do
trimmed_tag=$(echo "${tag}" | xargs)
if [ -n "${trimmed_tag}" ]; then
TAGS_LIST="${TAGS_LIST}${IMAGE}:${trimmed_tag}"$'\n'
fi
done
echo "tags<<EOF" >> "$GITHUB_OUTPUT"
echo -n "${TAGS_LIST}" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Build and Push Multi-Arch Image
uses: docker/build-push-action@v6
with:
@@ -89,5 +109,4 @@ runs:
file: ${{ inputs.build_dockerfile }}
builder: remote-builder
platforms: ${{ inputs.platforms }}
tags: |
${{ join(fromJSON(format('["{0}:{1}"]', inputs.image, join(split(inputs.image_tag, ','), format('","{0}:', inputs.image)))), '\n') }}
tags: ${{ steps.gentags.outputs.tags }}