File tree 3 files changed +13
-7
lines changed
3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 41
41
platforms : linux/amd64,linux/arm64
42
42
push : true
43
43
tags : ${{ steps.meta.outputs.tags }}
44
- labels : ${{ steps.meta.outputs.labels }}
44
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 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
2
4
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomex"
3
5
4
6
RUN apk add --no-cache make git
5
7
WORKDIR /app
6
8
COPY go.mod go.sum ./
7
9
RUN go mod download
8
10
COPY . .
9
- RUN make ; make build
10
11
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
12
18
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"
14
20
LABEL org.opencontainers.image.licenses=Apache-2.0
15
21
16
22
COPY --from=builder /app/build/sbomex /app/sbomex
17
23
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
18
24
19
- ENTRYPOINT [ "/app/sbomex" ]
25
+ ENTRYPOINT [ "/app/sbomex" ]
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ test: generate
61
61
62
62
.PHONY : build
63
63
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
65
65
66
66
.PHONY : clean
67
67
clean :
You can’t perform that action at this time.
0 commit comments