Files
skopeo/commit.go
Nalin Dahyabhai 0ab0890e4e Massive refactoring
Pull most of the core logic from the CLI into a package that should be
easier to consume as a library.  Add a "config" command that updates the
builder object's configuration.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-10 11:48:15 -05:00

31 lines
749 B
Go

package buildah
import (
"github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/types"
"github.com/containers/storage/pkg/archive"
)
type CommitOptions struct {
Compression archive.Compression
SignaturePolicyPath string
}
func (b *Builder) Commit(dest types.ImageReference, options CommitOptions) error {
policy, err := signature.DefaultPolicy(getSystemContext(options.SignaturePolicyPath))
if err != nil {
return err
}
policyContext, err := signature.NewPolicyContext(policy)
if err != nil {
return err
}
src, err := b.makeContainerImageRef(options.Compression)
if err != nil {
return err
}
err = copy.Image(policyContext, dest, src, getCopyOptions())
return err
}