Skip to content

Commit

Permalink
build: use containerd to load multi-platform images
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnjolitz committed Dec 17, 2024
1 parent 92d7ba2 commit c9215a5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Set up containerd
uses: crazy-max/ghaction-setup-containerd@v2

-
id: image_env
run: |
Expand All @@ -58,6 +62,7 @@ jobs:
'${{ matrix.repository }}'
docker pull "${SOURCE_IMAGE}" || true
echo "IMAGE_HOME=$(mktemp -d)" >> "$GITHUB_OUTPUT"
echo ALPINE_VERSION="${ALPINE_VERSION}" >> "$GITHUB_OUTPUT"
echo PYTHON_VERSION="${PYTHON_VERSION}" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -88,6 +93,7 @@ jobs:
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
BUILD_ROOT=/d
tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
outputs: type=oci,dest=${{ steps.image_env.outputs.IMAGE_HOME }}/buildroot.tar
-
name: distroless
uses: docker/build-push-action@v6
Expand All @@ -110,6 +116,13 @@ jobs:
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
BUILD_ROOT=/d
tags: "${{ steps.image_env.outputs.IMAGE_TAG }}"
outputs: type=oci,dest=${{ steps.image_env.outputs.IMAGE_HOME }}/image.tar

-
name: Import image in containerd
run: |
sudo ctr images import --base-name '${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot' --digests --all-platforms '${{ steps.image_env.outputs.IMAGE_HOME }}/buildroot.tar'
sudo ctr images import --base-name '${{ steps.image_env.outputs.IMAGE_TAG }}' --digests --all-platforms '${{ steps.image_env.outputs.IMAGE_HOME }}/image.tar'
-
name: examples/simple-flask
Expand All @@ -127,6 +140,12 @@ jobs:
build-args: |
SOURCE_IMAGE=${{ steps.image_env.outputs.IMAGE_TAG }}
tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-example1-amd64"
outputs: type=oci,dest=${{ steps.image_env.outputs.IMAGE_HOME }}/example1.tar

-
name: Import image in containerd
run: |
sudo ctr images import --base-name '${{ steps.image_env.outputs.IMAGE_TAG }}-example1-amd64' --digests --all-platforms '${{ steps.image_env.outputs.IMAGE_HOME }}/example1.tar'
-
name: Login to GitHub Container Registry
Expand Down

0 comments on commit c9215a5

Please sign in to comment.