Skip to content

Commit

Permalink
fix building images
Browse files Browse the repository at this point in the history
  • Loading branch information
BojanZelic authored Dec 29, 2024
1 parent 5c2f6bf commit 8c84d15
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
tags: |
type=sha,prefix=sha-
type=ref,event=tag
flavor: |
latest=false
suffix=${{ matrix.build.cache }}
# For pull requests, build and push platform-specific images
- name: Build and push Docker image
Expand All @@ -57,7 +60,7 @@ jobs:
context: .
platforms: ${{ matrix.build.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.build.cache }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.build.cache }}
Expand All @@ -83,22 +86,23 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=sha-
type=ref,event=tag
type=sha,prefix=sha-
- name: Create and push manifest list
- name: Create and push manifest lists
run: |
# Get the tag without the registry prefix
TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
MANIFEST_IMAGES=""
for CACHE in "amd64" "arm64"; do
MANIFEST_IMAGES="$MANIFEST_IMAGES ${TAG}-$CACHE"
done
# Read all tags into an array
readarray -t TAGS <<< "${{ steps.meta.outputs.tags }}"
# Trim leading space from MANIFEST_IMAGES
MANIFEST_IMAGES="${MANIFEST_IMAGES# }"
for TAG in "${TAGS[@]}"; do
MANIFEST_IMAGES=""
for CACHE in "amd64" "arm64"; do
MANIFEST_IMAGES="$MANIFEST_IMAGES ${TAG}-$CACHE"
done
# Trim leading space from MANIFEST_IMAGES
MANIFEST_IMAGES="${MANIFEST_IMAGES# }"
echo $MANIFEST_IMAGES
docker buildx imagetools create -t ${TAG} ${MANIFEST_IMAGES}
echo "Creating manifest list for ${TAG} with images: ${MANIFEST_IMAGES}"
docker buildx imagetools create -t ${TAG} ${MANIFEST_IMAGES}
done

0 comments on commit 8c84d15

Please sign in to comment.