Test 2 #11
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: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push: | |
| name: Build and Push GHCR Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU (arm emulation) | |
| uses: docker/setup-qemu-action@v3 | |
| - 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 (aarch64) | |
| env: | |
| TARGET_ARCH: linux/arm64 | |
| run: | | |
| set -euxo pipefail | |
| # Simple placeholder for testing the build step | |
| mkdir -p "${TARGET_ARCH}" | |
| touch "${TARGET_ARCH}/.placeholder" | |
| - name: Prepare rootfs (armv7h) | |
| env: | |
| TARGET_ARCH: linux/arm/v7 | |
| run: | | |
| set -euxo pipefail | |
| # Simple placeholder for testing the build step | |
| mkdir -p "${TARGET_ARCH}" | |
| touch "${TARGET_ARCH}/.placeholder" | |
| - name: Build and push multi-arch image | |
| env: | |
| IMAGE: ghcr.io/${{ github.repository_owner }}/docker-archlinuxarm | |
| run: | | |
| set -euxo pipefail | |
| DATE_TAG="$(date -u +%Y%m%d)" | |
| sudo --preserve-env=DOCKER_CONFIG docker buildx build --platform linux/arm64,linux/arm/v7 . -t $IMAGE:${DATE_TAG} --push | |
| # Inspect the pushed image to verify both platforms are present | |
| sudo --preserve-env=DOCKER_CONFIG docker buildx imagetools inspect "$IMAGE:${DATE_TAG}" |