diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 80b403a..268f578 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,11 +17,17 @@ jobs: matrix: include: - image: alpine + platform: linux/amd64,linux/arm64 - image: centos + platform: linux/amd64,linux/arm64 - image: debian + platform: linux/amd64,linux/arm64 - image: fedora + platform: linux/amd64,linux/arm64 - image: ubuntu + platform: linux/amd64,linux/arm64 - image: archlinux + platform: linux/amd64 steps: - uses: actions/checkout@v2 @@ -32,6 +38,7 @@ jobs: - run: ./ci-helpers/build.sh env: IMAGE: ${{ matrix.image }} + PLATFORM: ${{ matrix.platform }} SOURCE_IMAGE: ${{ matrix.source_image }} SKIP_REMOVE: false DOCKER_PUSH: "${{ github.ref == 'refs/heads/master' && '--push' || '' }}" diff --git a/ci-helpers/build-image.sh b/ci-helpers/build-image.sh index ebbf021..7434f3d 100755 --- a/ci-helpers/build-image.sh +++ b/ci-helpers/build-image.sh @@ -2,7 +2,8 @@ image=$1 tag=$2 -source_image=${3:-$image} +platform=$3 +source_image=${4:-$image} version=$(git tag --contains | tr 'v' '-') if [[ $image == ubuntu ]]; then @@ -31,12 +32,12 @@ EOF cd $workdir docker buildx build \ -t smartentry/$image:$tag \ - --platform linux/amd64,linux/arm64 \ + --platform $platform \ $DOCKER_PUSH . [[ -n $version ]] && docker buildx build \ -t smartentry/$image:$tag$version \ - --platform linux/amd64,linux/arm64 \ + --platform $platform \ $DOCKER_PUSH . [[ $SKIP_REMOVE == true ]] || docker buildx prune -a -f diff --git a/ci-helpers/build.sh b/ci-helpers/build.sh index 1265fd0..2ba643e 100755 --- a/ci-helpers/build.sh +++ b/ci-helpers/build.sh @@ -16,5 +16,5 @@ docker_tags () { } [[ -z $SKIP_LOGIN ]] && docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" -docker_tags ${SOURCE_IMAGE:-$IMAGE} | parallel --retries 3 -j 8 $BASEDIR/build-image.sh $IMAGE {} $SOURCE_IMAGE +docker_tags ${SOURCE_IMAGE:-$IMAGE} | parallel --retries 3 -j 8 $BASEDIR/build-image.sh $IMAGE {} $PLATFORM $SOURCE_IMAGE