Use arm64 runner instead of QEMU
Some checks are pending
docker-images / multi (., tunasync-scripts, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (., tunasync-scripts, ubuntu-latest) (push) Waiting to run
docker-images / multi (ftpsync, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (ftpsync, ubuntu-latest) (push) Waiting to run
docker-images / multi (nix-channels, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (nix-channels, ubuntu-latest) (push) Waiting to run
docker-images / multi (pub-mirror, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (pub-mirror, ubuntu-latest) (push) Waiting to run
docker-images / multi (rubygems-mirror, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (rubygems-mirror, ubuntu-latest) (push) Waiting to run
docker-images / multi (rustup-mirror, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (rustup-mirror, ubuntu-latest) (push) Waiting to run
docker-images / multi (shadowmire, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (shadowmire, ubuntu-latest) (push) Waiting to run
docker-images / multi (tsumugu, ubuntu-24.04-arm) (push) Waiting to run
docker-images / multi (tsumugu, ubuntu-latest) (push) Waiting to run
docker-images / merge (push) Blocked by required conditions

Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
Shengqi Chen 2025-09-03 00:03:59 +08:00 committed by Miao Wang
parent b2e66bdb6b
commit 82265fbd6f

View File

@ -2,11 +2,11 @@ name: docker-images
on:
push:
branches:
branches:
- master
- docker-test
pull_request:
branches:
branches:
- master
- docker-test
workflow_dispatch:
@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
image:
image:
- ftpsync
- nix-channels
- pub-mirror
@ -24,44 +24,33 @@ jobs:
- rustup-mirror
- shadowmire
- tsumugu
- tunasync-scripts
# - freighter
os:
- ubuntu-latest
- ubuntu-24.04-arm
include:
- image: tunasync-scripts
dockerfile: .
dockerfile_dir: .
# - image: julia-mirror
# dockerfile: dockerfiles/julia
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
-
name: Determin docker tag
-
name: Determine dockerfile dir
id: docker_file_dir
env:
TAG_NAME: ${{ github.ref }}
run: |
if [ "${TAG_NAME##*/}" = "master" ]; then
tag=latest
else
tag=build-test
fi
echo "docker_tag=${tag}" >> $GITHUB_ENV
-
name: Determin dockerfile
env:
DF: ${{ matrix.dockerfile }}
DF: ${{ matrix.dockerfile_dir }}
IMG: ${{ matrix.image }}
run: |
if [ -z "${DF}" ]; then
DF="dockerfiles/${IMG}"
fi
echo "docker_file=${DF}" >> $GITHUB_ENV
echo "docker_file_dir=${DF}" >> $GITHUB_OUTPUT
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@ -71,19 +60,21 @@ jobs:
if: github.event_name == 'push'
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.image }}-${{ github.sha }}
key: ${{ runner.os }}-${{ runner.arch }}-buildx-${{ matrix.image }}-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.image }}-
${{ runner.os }}-${{ runner.arch }}-buildx-${{ matrix.image }}-${{ matrix.os }}-
${{ runner.os }}-${{ runner.arch }}-buildx-${{ matrix.image }}-
-
name: Cache Docker layers
uses: actions/cache@v4
if: github.event_name == 'pull_request'
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-pr-${{ github.event.pull_request.head.user.login }}-buildx-${{ matrix.image }}-${{ github.sha }}
key: ${{ runner.os }}-${{ runner.arch }}-pr-${{ github.event.pull_request.head.user.login }}-buildx-${{ matrix.image }}-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pr-${{ github.event.pull_request.head.user.login }}-buildx-${{ matrix.image }}-
${{ runner.os }}-buildx-${{ matrix.image }}-
${{ runner.os }}-${{ runner.arch }}-pr-${{ github.event.pull_request.head.user.login }}-buildx-${{ matrix.image }}-${{ matrix.os }}-
${{ runner.os }}-${{ runner.arch }}-buildx-${{ matrix.image }}-${{ matrix.os }}-
${{ runner.os }}-${{ runner.arch }}-buildx-${{ matrix.image }}-
-
name: Cache Docker layers
if: github.event_name != 'push' && github.event_name != 'pull_request'
@ -99,12 +90,77 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
id: dockerbuild
with:
context: .
file: ${{ env.docker_file }}/Dockerfile
platforms: linux/amd64,linux/arm64
file: ${{ steps.docker_file_dir.outputs.docker_file_dir }}/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: tunathu/${{ matrix.image }}:${{ env.docker_tag }}
tags: tunathu/${{ matrix.image }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
outputs: ${{ github.event_name == 'push' && 'type=image,push-by-digest=true,name-canonical=true,push=true' || 'type=image' }}
-
name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests/${{ matrix.image }}
digest="${{ steps.dockerbuild.outputs.digest }}"
touch "${{ runner.temp }}/digests/${{ matrix.image }}/${digest#sha256:}"
-
name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.image }}-${{ matrix.os }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- multi
if: always() && github.event_name == 'push'
steps:
-
name: Determine docker tag
id: docker_tag
env:
TAG_NAME: ${{ github.ref }}
run: |
if [ "${TAG_NAME##*/}" = "master" ]; then
tag=latest
else
tag=build-test
fi
echo "docker_tag=${tag}" >> $GITHUB_OUTPUT
-
name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
for i in *; do
docker buildx imagetools create -t "tunathu/$i:${{ steps.docker_tag.outputs.docker_tag }}" \
$(printf "tunathu/$i@sha256:%s " $(ls $i))
done
- name: Inspect images
working-directory: ${{ runner.temp }}/digests
run: |
for i in *; do
docker buildx imagetools inspect "tunathu/$i:${{ steps.docker_tag.outputs.docker_tag }}"
done