From fa623894828da97f18fcbfabe759097dfd718596 Mon Sep 17 00:00:00 2001 From: takuya kodama Date: Mon, 1 Jul 2024 10:07:50 +0800 Subject: [PATCH] packages almalinux: add `--platform linux/arm64` when building arm64's image (#1807) ref: https://github.com/groonga/groonga/issues/1806 This change solves the following error on CI. Because Docker build process does not automatically detect the correct platform for the image. As a result, the platform information defaults to the host platform. So in this case, platform infromation wasn't as a arm64. To resolve this issue, we need to specify the platform explicitly in the Docker build command. ref: https://docs.docker.com/build/building/multi-platform/ Here is the error log: https://github.com/groonga/groonga/actions/runs/9705591558/job/26788067581#step:9:42 ``` ------ #3 [internal] load metadata for docker.io/arm64v8/almalinux:8 #3 ERROR: no match for platform in manifest: not found ------ Dockerfile:2 -------------------- 1 | ARG FROM=almalinux:8 2 | >>> FROM ${FROM} 3 | 4 | ARG DEBUG -------------------- ERROR: failed to solve: arm64v8/almalinux:8: failed to resolve source metadata for docker.io/arm64v8/almalinux:8: no match for platform in manifest: not found rake aborted!#1 [internal] load build definition from Dockerfile ``` --------- Co-authored-by: Horimoto Yasuhiro Co-authored-by: Sutou Kouhei --- .github/workflows/package.yml | 9 +++++++++ packages/yum/almalinux-8-aarch64/from | 2 +- packages/yum/almalinux-9-aarch64/from | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2ed2c3c0d4..7b74ad4158 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -327,7 +327,16 @@ jobs: # Test - name: Test run: | + case "${{ matrix.test-docker-image }}" in + arm64v8/*) + platform=linux/arm64 + ;; + *) + platform=linux/amd64 + ;; + esac docker run \ + --platform ${platform} \ --rm \ --volume ${PWD}:/groonga:ro \ ${{ matrix.test-docker-image }} \ diff --git a/packages/yum/almalinux-8-aarch64/from b/packages/yum/almalinux-8-aarch64/from index dcefc318ee..dc6d522a92 100644 --- a/packages/yum/almalinux-8-aarch64/from +++ b/packages/yum/almalinux-8-aarch64/from @@ -1 +1 @@ -arm64v8/almalinux:8 +--platform=linux/arm64 arm64v8/almalinux:8 diff --git a/packages/yum/almalinux-9-aarch64/from b/packages/yum/almalinux-9-aarch64/from index 4873d2ca10..9154373c27 100644 --- a/packages/yum/almalinux-9-aarch64/from +++ b/packages/yum/almalinux-9-aarch64/from @@ -1 +1 @@ -arm64v8/almalinux:9 +--platform=linux/arm64 arm64v8/almalinux:9