* rework CI validation workflow and makefile * enable push * fix job names * fix license check * fix snapshot builds * fix acceptance tests * fix linting * disable pull request event * rework windows runner caching * disable release pipeline and add issue templates
33 lines
607 B
Go
33 lines
607 B
Go
package docker
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/wagoodman/dive/dive/image"
|
|
)
|
|
|
|
type archiveResolver struct{}
|
|
|
|
func NewResolverFromArchive() *archiveResolver {
|
|
return &archiveResolver{}
|
|
}
|
|
|
|
func (r *archiveResolver) Fetch(path string) (*image.Image, error) {
|
|
reader, err := os.Open(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer reader.Close()
|
|
|
|
img, err := NewImageArchive(reader)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return img.ToImage()
|
|
}
|
|
|
|
func (r *archiveResolver) Build(args []string) (*image.Image, error) {
|
|
return nil, fmt.Errorf("build option not supported for docker archive resolver")
|
|
}
|