This commit is contained in:
Martin Zihlmann 2025-06-06 20:48:49 +02:00 committed by GitHub
commit 9e341c3631
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -398,10 +398,14 @@ func (s *stageBuilder) build() error {
continue
}
if isCacheCommand {
v := command.(commands.Cached)
layer := v.Layer()
if err := s.saveLayerToImage(layer, command.String()); err != nil {
return errors.Wrap(err, "failed to save layer")
if files != nil && len(files) == 0 {
logrus.Info("No files were changed, appending empty layer to config. No layer added to image.")
} else {
v := command.(commands.Cached)
layer := v.Layer()
if err := s.saveLayerToImage(layer, command.String()); err != nil {
return errors.Wrap(err, "failed to save layer")
}
}
} else {
tarPath, err := s.takeSnapshot(files, command.ShouldDetectDeletedFiles())