File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ FROM golang:latest AS builder
2626
2727WORKDIR /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
3033COPY . .
3134
@@ -35,6 +38,10 @@ RUN go mod tidy
3538# Build the Go binary
3639RUN 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
3946RUN 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
5663COPY --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
5969COPY ./views ./views/
6070COPY ./public ./public/
You can’t perform that action at this time.
0 commit comments