From 0353382631cdddb99b239e15953f9562b1754ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tagscherer=20=C3=81d=C3=A1m?= Date: Tue, 6 Jun 2023 12:37:33 +0200 Subject: [PATCH] feat: add arm64 support for docker image --- .github/workflows/reusable-build-and-push.yml | 1 + Dockerfile | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-build-and-push.yml b/.github/workflows/reusable-build-and-push.yml index 6e070e4..e20b536 100644 --- a/.github/workflows/reusable-build-and-push.yml +++ b/.github/workflows/reusable-build-and-push.yml @@ -62,6 +62,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . + platforms: linux/amd64,linux/arm64 tags: ghcr.io/openclarity/grype-server:${{ inputs.image_tag }} file: Dockerfile push: ${{ inputs.push }} diff --git a/Dockerfile b/Dockerfile index b4cadd8..35d359d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4-alpine AS builder +FROM --platform=$BUILDPLATFORM golang:1.20.4-alpine AS builder RUN apk add --update --no-cache gcc g++ @@ -11,7 +11,11 @@ RUN go mod download # Copy and build backend code COPY grype-server . -RUN go build -o grype-server ./cmd/grype-server/main.go + +ARG TARGETOS +ARG TARGETARCH + +RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o grype-server ./cmd/grype-server/main.go FROM alpine:3.17