From 05f0b904030bc79522e47869ab47a784393f4282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Mon, 3 Apr 2023 12:26:06 +0200 Subject: [PATCH 1/5] Add arm v8 (Apple M) as build target --- .github/workflows/build_container.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 7d0316c6f..f19b8a79d 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -47,6 +47,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + with: + platforms: linux/arm64,linux/arm/v8 - name: Docker metadata id: meta From 96b54451396279b0cc58dc233fdf3d97db502176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Mon, 3 Apr 2023 12:27:25 +0200 Subject: [PATCH 2/5] Dumb commit to force action run --- .github/workflows/build_container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index f19b8a79d..603f7eb5c 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -67,7 +67,7 @@ jobs: type=ref,event=pr type=sha - - name: Publish image + - name: Build and publish image id: push uses: docker/build-push-action@v4 with: From 631161b27c8147bb44422a1ed792e8ae3f8e889d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Mon, 3 Apr 2023 14:55:28 +0200 Subject: [PATCH 3/5] Better to set platforms on build job, and use variable --- .github/workflows/build_container.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 603f7eb5c..495e8d3a8 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -17,6 +17,7 @@ env: IMAGE_NAME: sonarqube-ecocode IMAGES: | ghcr.io/${{ github.repository_owner }}/sonarqube-ecocode + PLATFORMS: linux/arm64,linux/arm/v8 jobs: Build: @@ -47,8 +48,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - with: - platforms: linux/arm64,linux/arm/v8 - name: Docker metadata id: meta @@ -71,6 +70,8 @@ jobs: id: push uses: docker/build-push-action@v4 with: + context: . + platforms: ${{ env.PLATFORMS }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 82a4e28c418541f458e1d8937ad56aa33fc48cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Tue, 4 Apr 2023 10:29:59 +0200 Subject: [PATCH 4/5] Build only on amd64 platform (there is no arm64 maven) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0fd4e5340..e9dd8620f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM maven:3-openjdk-11-slim AS builder +FROM --platform=linux/amd64 maven:3-openjdk-11-slim AS builder COPY . /usr/src/ecocode From 3fc820d9ced1fe60296a3fdeebbb43f06b4f58a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81goire=20Compagnon?= Date: Tue, 4 Apr 2023 10:44:18 +0200 Subject: [PATCH 5/5] Correct typos in platform names --- .github/workflows/build_container.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index 495e8d3a8..41b623fef 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -17,7 +17,7 @@ env: IMAGE_NAME: sonarqube-ecocode IMAGES: | ghcr.io/${{ github.repository_owner }}/sonarqube-ecocode - PLATFORMS: linux/arm64,linux/arm/v8 + PLATFORMS: linux/amd64,linux/arm64/v8 jobs: Build: