chainguard-dev / apko

Build OCI images from APK packages directly without Dockerfile

Home Page:https://apko.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't hash the layer twice

jonjohnsonjr opened this issue · comments

We calculate the layer digest in GenerateImageSBOM by reading it from disk and hashing it.

We don't need to do that, because we have to calculate the digest already before this. We should pass that value down into this function (or just get it from the passed in img).

if err := s.ReadLayerTarball(o.TarballPath); err != nil {
return nil, fmt.Errorf("reading layer tar: %w", err)
}

This will save ~1ms per MB.