2018-04-19 13:07:27 -04:00
|
|
|
package llb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2018-08-11 15:04:13 -04:00
|
|
|
gw "github.com/moby/buildkit/frontend/gateway/client"
|
2018-04-19 13:07:27 -04:00
|
|
|
digest "github.com/opencontainers/go-digest"
|
|
|
|
)
|
|
|
|
|
2018-09-26 08:26:12 -04:00
|
|
|
// WithMetaResolver adds a metadata resolver to an image
|
2018-04-19 13:07:27 -04:00
|
|
|
func WithMetaResolver(mr ImageMetaResolver) ImageOption {
|
2018-08-11 15:04:13 -04:00
|
|
|
return imageOptionFunc(func(ii *ImageInfo) {
|
2018-04-19 13:07:27 -04:00
|
|
|
ii.metaResolver = mr
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-09-26 08:26:12 -04:00
|
|
|
// ImageMetaResolver can resolve image config metadata from a reference
|
2018-04-19 13:07:27 -04:00
|
|
|
type ImageMetaResolver interface {
|
2018-08-11 15:04:13 -04:00
|
|
|
ResolveImageConfig(ctx context.Context, ref string, opt gw.ResolveImageConfigOpt) (digest.Digest, []byte, error)
|
2018-04-19 13:07:27 -04:00
|
|
|
}
|