Skip to content

Commit dc4029a

Browse files
Merge pull request #53 from viveksahu26/support_arm64_arch
add image support for arm64 arch
2 parents e2a72ff + c271278 commit dc4029a

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
platforms: linux/amd64,linux/arm64
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
44+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
FROM golang:1.20-alpine AS builder
1+
# Use buildx for multi-platform builds
2+
# Build stage
3+
FROM --platform=$BUILDPLATFORM golang:1.22.2-alpine AS builder
24
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomex"
35

46
RUN apk add --no-cache make git
57
WORKDIR /app
68
COPY go.mod go.sum ./
79
RUN go mod download
810
COPY . .
9-
RUN make ; make build
1011

11-
FROM scratch
12+
# Build for multiple architectures
13+
ARG TARGETOS TARGETARCH
14+
RUN make build && chmod +x ./build/sbomex
15+
16+
# Final stage
17+
FROM alpine:3.19
1218
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomex"
13-
LABEL org.opencontainers.image.description="SBOM Explorer - Find and pull public SBOMs"
19+
LABEL org.opencontainers.image.description="Find & pull public SBOMs"
1420
LABEL org.opencontainers.image.licenses=Apache-2.0
1521

1622
COPY --from=builder /app/build/sbomex /app/sbomex
1723
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
1824

19-
ENTRYPOINT [ "/app/sbomex"]
25+
ENTRYPOINT [ "/app/sbomex"]

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test: generate
6161

6262
.PHONY: build
6363
build:
64-
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/sbomex main.go
64+
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/sbomex main.go
6565

6666
.PHONY: clean
6767
clean:

0 commit comments

Comments
 (0)