From f170b4e7fbd727b2da3148d9a15e8469f50ade0d Mon Sep 17 00:00:00 2001 From: Rajashekhar Gundeti Date: Wed, 19 Jun 2024 22:00:21 +0530 Subject: [PATCH] Support ARM arch --- .github/workflows/build-n-push.yaml | 11 ++++------- Makefile | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-n-push.yaml b/.github/workflows/build-n-push.yaml index f2369973..022f5cf4 100644 --- a/.github/workflows/build-n-push.yaml +++ b/.github/workflows/build-n-push.yaml @@ -36,14 +36,11 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Log into GitHub Container Registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin + run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin - - name: Build Image - run: IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-build - - - name: Push Image - run: IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-push + - name: Build and Push Image + run: IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-build-push - name: Print Image Path id: print-docker-image-path - run: echo IMAGE_PATH=`IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make print-docker-image-path` >> $GITHUB_OUTPUT \ No newline at end of file + run: echo IMAGE_PATH=`IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make print-docker-image-path` >> $GITHUB_OUTPUT diff --git a/Makefile b/Makefile index d2dddfb4..8497eb04 100644 --- a/Makefile +++ b/Makefile @@ -46,18 +46,18 @@ build: cmd/server/main.go go build -ldflags $(LDFLAGS) -mod vendor -o dist/provider ./cmd/server/main.go docker-build: - docker build -t ${IMAGE_PATH} -f build/Dockerfile . + docker buildx build --platform=linux/amd64,linux/arm64 -t ${IMAGE_PATH} -f build/Dockerfile . # docker buildx build --platform=linux/amd64 -t ${IMAGE_PATH} -f build/Dockerfile . docker-push: docker push ${IMAGE_PATH} -docker-build-push: docker-build - docker push ${IMAGE_PATH} +docker-build-push: + docker buildx build --push --platform=linux/amd64,linux/arm64 -t ${IMAGE_PATH} -f build/Dockerfile . print-docker-image-path: @echo ${IMAGE_PATH} test-coverage: go test -coverprofile=cover.out ./… - go tool cover -html=cover.out \ No newline at end of file + go tool cover -html=cover.out