Skip to content

Commit

Permalink
build: try a manual docker build for arm64 variant 8
Browse files Browse the repository at this point in the history
  • Loading branch information
autumnjolitz committed Dec 17, 2024
1 parent 1f763c3 commit 1ffb16e
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
runs-on: ${{ matrix.os }}
permissions:
packages: write
env:
PLATFORMS: 'linux/amd64 linux/arm64/v8'

steps:
-
Expand Down Expand Up @@ -137,32 +139,42 @@ jobs:
registry: 'docker.io'
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Upload Buildroot
uses: docker/build-push-action@v6
with:
push: true
provenance: false
platforms: |
linux/amd64
linux/arm64/v8
context: "."
file: Dockerfile.alpine
target: buildroot
cache-to: |
type=gha
cache-from: |
type=gha
type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
build-args: |
ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
BUILD_ROOT=/d
tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
env:
IMAGE_URI: ${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
run: |
for platform in $PLATFORMS
do
docker build --platform "$platform" --push --cache-to type=gha --cache-from type=gha --build-arg 'ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}' --build-arg 'BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}' --build-arg 'PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}' --build-arg 'SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}' --build-arg 'BUILD_ROOT=/d' --tag "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" -f Dockerfile.alpine .
echo "${IMAGE_URI}-$(echo "${platform}" | tr '/' '-' )" | tee -a $IMAGE_HOME/images.txt
done
docker manifest create "${IMAGE_URI}" $(cat $IMAGE_HOME/images.txt)
docker manifest push "${IMAGE_URI}"
# -
# name: Upload Buildroot
# uses: docker/build-push-action@v6
# with:
# push: true
# provenance: false
# platforms: |
# linux/amd64
# linux/arm64/v8
# context: "."
# file: Dockerfile.alpine
# target: buildroot
# cache-to: |
# type=gha
# cache-from: |
# type=gha
# type=registry,ref=${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot
# type=registry,ref=${{ steps.image_env.outputs.SOURCE_IMAGE }}@${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
# build-args: |
# ALPINE_VERSION=${{ steps.image_env.outputs.ALPINE_VERSION }}
# BASE_IMAGE_DIGEST=${{ steps.image_env.outputs.BASE_IMAGE_DIGEST }}
# PYTHON_VERSION=${{ steps.image_env.outputs.PYTHON_VERSION }}
# SOURCE_IMAGE=${{ steps.image_env.outputs.SOURCE_IMAGE }}
# BUILD_ROOT=/d
# tags: "${{ steps.image_env.outputs.IMAGE_TAG }}-buildroot"
-
name: Upload
uses: docker/build-push-action@v6
Expand Down

0 comments on commit 1ffb16e

Please sign in to comment.