diff --git a/Dockerfile b/Dockerfile index ca039428..09bd4862 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,9 +11,14 @@ ARG TARGETPLATFORM WORKDIR /src RUN \ --mount=type=bind,target=. \ - --mount=type=cache,target=/root/.cache \ - xx-go build -ldflags '-extldflags -static' -o /usr/local/bin/syft-scanner ./cmd/syft-scanner && \ + --mount=type=cache,target=/root/.cache <,push=true --opt attest:sbom=generator=jedevc/buildkit-syft-scanner + --output type=image,name=,push=true --opt attest:sbom=generator=docker/buildkit-syft-scanner diff --git a/cmd/syft-scanner/main.go b/cmd/syft-scanner/main.go index 8b142365..155624c3 100644 --- a/cmd/syft-scanner/main.go +++ b/cmd/syft-scanner/main.go @@ -8,7 +8,7 @@ import ( "github.com/anchore/go-logger/adapter/logrus" "github.com/anchore/stereoscope" "github.com/anchore/syft/syft" - "github.com/jedevc/buildkit-syft-scanner/internal" + "github.com/docker/buildkit-syft-scanner/internal" ) func main() { diff --git a/go.mod b/go.mod index e8ec7c5b..a6523578 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/jedevc/buildkit-syft-scanner +module github.com/docker/buildkit-syft-scanner go 1.19 diff --git a/internal/target.go b/internal/target.go index ec5f4034..459418ab 100644 --- a/internal/target.go +++ b/internal/target.go @@ -3,7 +3,6 @@ package internal import ( "fmt" "path/filepath" - "runtime/debug" "github.com/anchore/syft/syft" "github.com/anchore/syft/syft/pkg/cataloger" @@ -38,7 +37,7 @@ func (t Target) Scan() (sbom.SBOM, error) { Source: src.Metadata, Descriptor: sbom.Descriptor{ Name: "syft", - Version: syftVersion(), + Version: SyftVersion, }, } @@ -54,16 +53,8 @@ func (t Target) Scan() (sbom.SBOM, error) { return result, nil } -func syftVersion() string { - info, ok := debug.ReadBuildInfo() - if !ok { - return "unknown" - } +const defaultSyftVersion = "[not provided]" - for _, dep := range info.Deps { - if dep.Path == "github.com/anchore/syft" { - return dep.Version - } - } - return "unknown" -} +var ( + SyftVersion = defaultSyftVersion +)