mirror of
https://github.com/mudler/luet.git
synced 2025-09-05 09:10:43 +00:00
Don't export unless needed
This commit is contained in:
@@ -353,7 +353,7 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
return nil, errors.Wrap(err, "Failed building image for "+runnerOpts.ImageName+" "+runnerOpts.DockerFileName)
|
return nil, errors.Wrap(err, "Failed building image for "+runnerOpts.ImageName+" "+runnerOpts.DockerFileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if generateArtifact {
|
||||||
if err := cs.Backend.ExportImage(runnerOpts); err != nil {
|
if err := cs.Backend.ExportImage(runnerOpts); err != nil {
|
||||||
return nil, errors.Wrap(err, "Failed exporting image")
|
return nil, errors.Wrap(err, "Failed exporting image")
|
||||||
}
|
}
|
||||||
@@ -361,6 +361,7 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
if !cs.Options.KeepImageExport {
|
if !cs.Options.KeepImageExport {
|
||||||
defer os.Remove(runnerOpts.Destination)
|
defer os.Remove(runnerOpts.Destination)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if cs.Options.Push && buildPackageImage {
|
if cs.Options.Push && buildPackageImage {
|
||||||
err = cs.Backend.Push(runnerOpts)
|
err = cs.Backend.Push(runnerOpts)
|
||||||
@@ -378,6 +379,7 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
unpack = true
|
unpack = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if generateArtifact {
|
||||||
rootfs, err := ioutil.TempDir(p.GetOutputPath(), "rootfs")
|
rootfs, err := ioutil.TempDir(p.GetOutputPath(), "rootfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Could not create tempdir")
|
return nil, errors.Wrap(err, "Could not create tempdir")
|
||||||
@@ -391,6 +393,7 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "Could not extract rootfs")
|
return nil, errors.Wrap(err, "Could not extract rootfs")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !keepImg {
|
if !keepImg {
|
||||||
// We keep them around, so to not reload them from the tar (which should be the "correct way") and we automatically share the same layers
|
// We keep them around, so to not reload them from the tar (which should be the "correct way") and we automatically share the same layers
|
||||||
|
Reference in New Issue
Block a user