Skip to content

Commit

Permalink
Publish arm docker images as part of the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
noituri committed Jan 9, 2025
1 parent 97405df commit 43896df
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 10 deletions.
74 changes: 72 additions & 2 deletions .github/workflows/package_for_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
name: smelter_with_web_renderer_darwin_aarch64.tar.gz
path: smelter_with_web_renderer_darwin_aarch64.tar.gz

docker:
docker-amd64:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
Expand All @@ -145,7 +145,42 @@ jobs:
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}

docker-with-web-renderer:
docker-arm64:
needs: docker-amd64
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4

- name: 🛠️ Setup Docker
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🎣 Pull Smleter AMD64 image
run: |
docker pull ghcr.io/software-mansion/smelter:${{ github.sha }}
echo "AMD64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }})" >> "$GITHUB_ENV"
- name: 🔨 Build Smelter ARM64 image
run: |
docker buildx build --platform linux/arm64 -t ghcr.io/software-mansion/smelter:${{ github.sha }} -f build_tools/docker/slim.Dockerfile .
- name: ⏩ Push ARM64 image
run: |
docker push ghcr.io/software-mansion/smelter:${{ github.sha }}
echo "ARM64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }})" >> "$GITHUB_ENV"
- name: 🔗 Merge AMD64 and ARM64 images
run: |
docker manifest create ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.AMD64_IMAGE_ID }} ${{ env.ARM64_IMAGE_ID }}
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.AMD64_IMAGE_ID }} --arch amd64
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }} ${{ env.ARM64_IMAGE_ID }} --arch arm64
- name: 📤 Upload image
run: docker manifest push ghcr.io/software-mansion/smelter:${{ github.sha }}

docker-with-web-renderer-amd64:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
Expand All @@ -161,3 +196,38 @@ jobs:
- name: 📤 Upload image
run: docker push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer

docker-with-web-renderer-arm64:
needs: docker-with-web-renderer-amd64
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout repo
uses: actions/checkout@v4

- name: 🛠️ Setup Docker
run: |
docker run --privileged --rm tonistiigi/binfmt --install all
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 🎣 Pull Smleter AMD64 image
run: |
docker pull ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
echo "AMD64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer)" >> "$GITHUB_ENV"
- name: 🔨 Build Smelter ARM64 image
run: |
docker buildx build --platform linux/arm64 -t ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer -f build_tools/docker/full.Dockerfile .
- name: ⏩ Push ARM64 image
run: |
docker push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
echo "ARM64_IMAGE_ID=$(docker inspect --format='{{index .RepoDigests 0}}' ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer)" >> "$GITHUB_ENV"
- name: 🔗 Merge AMD64 and ARM64 images
run: |
docker manifest create ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.AMD64_IMAGE_ID }} ${{ env.ARM64_IMAGE_ID }}
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.AMD64_IMAGE_ID }} --arch amd64
docker manifest annotate ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer ${{ env.ARM64_IMAGE_ID }} --arch arm64
- name: 📤 Upload image
run: docker manifest push ghcr.io/software-mansion/smelter:${{ github.sha }}-web-renderer
10 changes: 2 additions & 8 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ gh run download "$WORKFLOW_RUN_ID" -n smelter_with_web_renderer_darwin_x86_64.ta
gh run download "$WORKFLOW_RUN_ID" -n smelter_with_web_renderer_darwin_aarch64.tar.gz

IMAGE_NAME="ghcr.io/software-mansion/smelter"
docker pull "${IMAGE_NAME}:${COMMIT_HASH}"
docker pull "${IMAGE_NAME}:${COMMIT_HASH}-web-renderer"

docker tag "${IMAGE_NAME}:${COMMIT_HASH}" "${IMAGE_NAME}:${RELEASE_TAG}"
docker tag "${IMAGE_NAME}:${COMMIT_HASH}-web-renderer" "${IMAGE_NAME}:${RELEASE_TAG}-web-renderer"

docker push "${IMAGE_NAME}:${RELEASE_TAG}"
docker push "${IMAGE_NAME}:${RELEASE_TAG}-web-renderer"
docker buildx imagetools create -t "${IMAGE_NAME}:${RELEASE_TAG}" "${IMAGE_NAME}:${COMMIT_HASH}"
docker buildx imagetools create -t "${IMAGE_NAME}:${RELEASE_TAG}-web-renderer" "${IMAGE_NAME}:${COMMIT_HASH}-web-renderer"

gh release create "$RELEASE_TAG"
gh release upload "$RELEASE_TAG" smelter_linux_x86_64.tar.gz
Expand Down

0 comments on commit 43896df

Please sign in to comment.