From 5ce06cf18384ee99bd0b039440ebc46f1db455ca Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Thu, 2 May 2024 15:17:10 +0200 Subject: [PATCH] Build Docker images for arm64 Signed-off-by: Fabio Di Fabio --- .github/workflows/workflow.yaml | 17 ++++++++++++----- build.gradle | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index a9bc5b32381..650637da3db 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -85,12 +85,19 @@ jobs: CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }} CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + - name: Set up QEMU for Docker + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 + - name: Check Dockerfile syntax run: | docker run --rm -i hadolint/hadolint < docker/Dockerfile - - name: Build Docker Image - run: | - ./gradlew dockerDist - name: Login to Docker Hub for self hosted uses: docker/login-action@v2 @@ -98,6 +105,6 @@ jobs: username: ${{ secrets.DOCKER_USER_RW }} password: ${{ secrets.DOCKER_PAT_RW }} - - name: Publish Docker Image + - name: Build and Publish Docker Image run: | - ./gradlew dockerUpload + ./gradlew -Pdocker-platform=linux/amd64,linux/arm64 distDocker diff --git a/build.gradle b/build.gradle index 1b45d7621f8..0297c717949 100644 --- a/build.gradle +++ b/build.gradle @@ -717,7 +717,7 @@ task distDocker { def gitDetails = getGitCommitDetails(7) executable shell workingDir dockerBuildDir - args "-c", "docker build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${gitDetails.hash} -t ${image} ." + args "-c", "docker buildx build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${gitDetails.hash} -t ${image} --push ." } } }