Skip to content

Commit c301813

Browse files
feat: add arm64 support for docker image (#31)
1 parent ec80c8f commit c301813

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/reusable-build-and-push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
uses: docker/build-push-action@v4
6363
with:
6464
context: .
65+
platforms: linux/amd64,linux/arm64
6566
tags: ghcr.io/openclarity/grype-server:${{ inputs.image_tag }}
6667
file: Dockerfile
6768
push: ${{ inputs.push }}

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20.4-alpine AS builder
1+
FROM --platform=$BUILDPLATFORM golang:1.20.4-alpine AS builder
22

33
RUN apk add --update --no-cache gcc g++
44

@@ -11,7 +11,11 @@ RUN go mod download
1111

1212
# Copy and build backend code
1313
COPY grype-server .
14-
RUN go build -o grype-server ./cmd/grype-server/main.go
14+
15+
ARG TARGETOS
16+
ARG TARGETARCH
17+
18+
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o grype-server ./cmd/grype-server/main.go
1519

1620
FROM alpine:3.17
1721

0 commit comments

Comments
 (0)