mirror of
https://github.com/mudler/luet.git
synced 2025-09-04 16:50:50 +00:00
Don't export unless needed
This commit is contained in:
@@ -353,13 +353,14 @@ 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 {
|
||||||
|
return nil, errors.Wrap(err, "Failed exporting image")
|
||||||
|
}
|
||||||
|
|
||||||
if err := cs.Backend.ExportImage(runnerOpts); err != nil {
|
if !cs.Options.KeepImageExport {
|
||||||
return nil, errors.Wrap(err, "Failed exporting image")
|
defer os.Remove(runnerOpts.Destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cs.Options.KeepImageExport {
|
|
||||||
defer os.Remove(runnerOpts.Destination)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if cs.Options.Push && buildPackageImage {
|
if cs.Options.Push && buildPackageImage {
|
||||||
@@ -378,18 +379,20 @@ func (cs *LuetCompiler) compileWithImage(image, buildertaggedImage, packageImage
|
|||||||
unpack = true
|
unpack = true
|
||||||
}
|
}
|
||||||
|
|
||||||
rootfs, err := ioutil.TempDir(p.GetOutputPath(), "rootfs")
|
if generateArtifact {
|
||||||
if err != nil {
|
rootfs, err := ioutil.TempDir(p.GetOutputPath(), "rootfs")
|
||||||
return nil, errors.Wrap(err, "Could not create tempdir")
|
if err != nil {
|
||||||
}
|
return nil, errors.Wrap(err, "Could not create tempdir")
|
||||||
defer os.RemoveAll(rootfs) // clean up
|
}
|
||||||
|
defer os.RemoveAll(rootfs) // clean up
|
||||||
|
|
||||||
// TODO: Compression and such
|
// TODO: Compression and such
|
||||||
err = cs.Backend.ExtractRootfs(CompilerBackendOptions{
|
err = cs.Backend.ExtractRootfs(CompilerBackendOptions{
|
||||||
ImageName: packageImage,
|
ImageName: packageImage,
|
||||||
SourcePath: runnerOpts.Destination, Destination: rootfs}, keepPermissions)
|
SourcePath: runnerOpts.Destination, Destination: rootfs}, keepPermissions)
|
||||||
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 {
|
||||||
|
Reference in New Issue
Block a user