From c5bb9a8fa21c418827c4b4f43b145fc10cb6288e Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 24 Apr 2024 15:56:57 +1000 Subject: [PATCH 1/2] build: enable multiarch image building --- .github/workflows/build_and_publish.yml | 1 + Dockerfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index c434451..e6d49e1 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -52,6 +52,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index feec767..e327331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN go mod download COPY main.go main.go # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o insights-handler main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -o insights-handler main.go # we pull the trivy binary from aquasec's alpine based image FROM aquasec/trivy:0.49.1 as trivy From 6ee8beff2607f0fee6d4d6210266a809cd19657c Mon Sep 17 00:00:00 2001 From: Toby Bellwood Date: Wed, 24 Apr 2024 18:06:38 +1000 Subject: [PATCH 2/2] build: enable PR image building --- .github/workflows/build_and_publish.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index e6d49e1..da4fef1 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -34,14 +34,12 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to Docker Hub - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io @@ -53,6 +51,6 @@ jobs: with: context: . platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file