Swap aarch64 and armv7 #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build ArchLinuxARM Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 15 * * 5' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| name: Build and Push GHCR Image | |
| runs-on: ubuntu-22.04-arm | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set shared Docker config | |
| run: echo "DOCKER_CONFIG=$RUNNER_TEMP/.docker" >> "$GITHUB_ENV" | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare rootfs (armv7h) | |
| env: | |
| PLATFORM: linux/arm/v7 | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p "${PLATFORM}" | |
| docker run --rm --platform "${PLATFORM}" \ | |
| -v "$(pwd)/${PLATFORM}:/mnt" \ | |
| -v "$(pwd)/setup-arch.sh:/setup-arch.sh" \ | |
| --privileged alpine /setup-arch.sh | |
| - name: Prepare rootfs (aarch64) | |
| env: | |
| PLATFORM: linux/arm64 | |
| run: | | |
| set -euxo pipefail | |
| mkdir -p "${PLATFORM}" | |
| docker run --rm --platform "${PLATFORM}" \ | |
| -v "$(pwd)/${PLATFORM}:/mnt" \ | |
| -v "$(pwd)/setup-arch.sh:/setup-arch.sh" \ | |
| --privileged alpine /setup-arch.sh | |
| - name: Build and push multi-arch image | |
| env: | |
| IMAGE: ghcr.io/${{ github.repository_owner }}/docker-archlinuxarm | |
| run: | | |
| set -euxo pipefail | |
| sudo --preserve-env=DOCKER_CONFIG docker buildx create --name rootbuilder --use | |
| DATE_TAG="$(date -u +%F)" | |
| sudo --preserve-env=DOCKER_CONFIG docker buildx build --platform linux/arm64,linux/arm/v7 . -t $IMAGE:${DATE_TAG} -t $IMAGE:latest --push | |
| # Inspect the pushed image to verify both platforms are present | |
| sudo --preserve-env=DOCKER_CONFIG docker buildx imagetools inspect "$IMAGE:${DATE_TAG}" |