feat: add composite action to build and push multi-arch images via remote Docker builder
This commit is contained in:
@@ -81,6 +81,26 @@ runs:
|
|||||||
docker context use remote-builder
|
docker context use remote-builder
|
||||||
docker buildx inspect --bootstrap
|
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
|
- name: Build and Push Multi-Arch Image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
@@ -89,5 +109,4 @@ runs:
|
|||||||
file: ${{ inputs.build_dockerfile }}
|
file: ${{ inputs.build_dockerfile }}
|
||||||
builder: remote-builder
|
builder: remote-builder
|
||||||
platforms: ${{ inputs.platforms }}
|
platforms: ${{ inputs.platforms }}
|
||||||
tags: |
|
tags: ${{ steps.gentags.outputs.tags }}
|
||||||
${{ join(fromJSON(format('["{0}:{1}"]', inputs.image, join(split(inputs.image_tag, ','), format('","{0}:', inputs.image)))), '\n') }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user