Skip to content

Commit 6f73430

Browse files
committed
fix(build): restore syft using curl instead of go install
1 parent 4354de0 commit 6f73430

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ FROM golang:latest AS builder
2626

2727
WORKDIR /build
2828

29+
# Install Syft for SBOM generation
30+
RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /go/bin
31+
2932
# Copy source code
3033
COPY . .
3134

@@ -35,6 +38,10 @@ RUN go mod tidy
3538
# Build the Go binary
3639
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-linkmode external -extldflags -static" -a -installsuffix cgo -o main_linux_amd64.bin main.go
3740

41+
# Generate SBOM for the application
42+
# This scans the built binary and vendor dependencies
43+
RUN /go/bin/syft packages . -o spdx-json=sbom.spdx.json
44+
3845
# Generate a checksum for the binary
3946
RUN sha256sum main_linux_amd64.bin > main_linux_amd64.bin.sha256sum
4047

@@ -55,6 +62,9 @@ RUN apk add --no-cache ffmpeg bash
5562
# Copy the application binary from the builder stage
5663
COPY --from=builder /build/main_linux_amd64.bin ./main.bin
5764

65+
# Copy the SBOM from the builder stage
66+
COPY --from=builder /build/sbom.spdx.json /app/sbom.spdx.json
67+
5868
# Copy other necessary application files
5969
COPY ./views ./views/
6070
COPY ./public ./public/

0 commit comments

Comments
 (0)