dive/dive/image/docker/layer.go
Alex Goodman d5e8a92968
Rework CI validation workflow and makefile (#460)
* 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
2023-07-06 22:01:46 -04:00

31 lines
670 B
Go

package docker
import (
"strings"
"github.com/wagoodman/dive/dive/filetree"
"github.com/wagoodman/dive/dive/image"
)
// Layer represents a Docker image layer and metadata
type layer struct {
history historyEntry
index int
tree *filetree.FileTree
}
// String represents a layer in a columnar format.
func (l *layer) ToLayer() *image.Layer {
id := strings.Split(l.tree.Name, "/")[0]
return &image.Layer{
Id: id,
Index: l.index,
Command: strings.TrimPrefix(l.history.CreatedBy, "/bin/sh -c "),
Size: l.history.Size,
Tree: l.tree,
// todo: query docker api for tags
Names: []string{"(unavailable)"},
Digest: l.history.ID,
}
}