mirror of
https://github.com/containers/buildah.git
synced 2025-07-30 04:23:09 +03:00
Implement --squash for build-using-dockerfile and commit
Handle a Squash option when committing images, and make it available as a flag for "buildah commit" and "buildah build-using-dockerfile". Breaks up containerImageRef.NewImageSource to keep the complexity more manageable. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> Closes: #714 Approved by: rhatdan
This commit is contained in:
committed by
Atomic Bot
parent
e59fd7a19d
commit
c806e6e065
@ -50,6 +50,9 @@ type CommitOptions struct {
|
||||
SystemContext *types.SystemContext
|
||||
// IIDFile tells the builder to write the image ID to the specified file
|
||||
IIDFile string
|
||||
// Squash tells the builder to produce an image with a single layer
|
||||
// instead of with possibly more than one layer.
|
||||
Squash bool
|
||||
// Labels metadata for an image
|
||||
Labels []string
|
||||
}
|
||||
@ -112,7 +115,7 @@ func (b *Builder) Commit(ctx context.Context, dest types.ImageReference, options
|
||||
// Check if we're keeping everything in local storage. If so, we can take certain shortcuts.
|
||||
_, destIsStorage := dest.Transport().(is.StoreTransport)
|
||||
exporting := !destIsStorage
|
||||
src, err := b.makeImageRef(options.PreferredManifestType, exporting, options.Compression, options.HistoryTimestamp)
|
||||
src, err := b.makeImageRef(options.PreferredManifestType, exporting, options.Squash, options.Compression, options.HistoryTimestamp)
|
||||
if err != nil {
|
||||
return imgID, errors.Wrapf(err, "error computing layer digests and building metadata")
|
||||
}
|
||||
|
Reference in New Issue
Block a user