Skip to content

Commit 8492058

Browse files
rncgoldmann
authored andcommitted
Improve logging. Fix cleanup in dev mode
1 parent 6690fde commit 8492058

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

docker_squash/image.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,12 @@ def _before_squashing(self):
186186
try:
187187
number_of_layers = int(self.from_layer)
188188

189-
self.log.debug("We detected number of layers as the argument to squash")
189+
self.log.debug(
190+
f"We detected number of layers ({number_of_layers}) as the argument to squash"
191+
)
190192
except ValueError:
191-
self.log.debug("We detected layer as the argument to squash")
192-
193193
squash_id = self._squash_id(self.from_layer)
194+
self.log.debug(f"We detected layer ({squash_id}) as the argument to squash")
194195

195196
if not squash_id:
196197
raise SquashError(

docker_squash/squash.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ def squash(self, image: Image):
143143
# Load squashed image into Docker
144144
image.load_squashed_image()
145145

146-
# Clean up all temporary files
147-
image.cleanup()
146+
# If development mode is not enabled, make sure we clean up the
147+
# temporary directory
148+
if not self.development:
149+
# Clean up all temporary files
150+
image.cleanup()
148151

149152
# Remove the source image - this is the only possible way
150153
# to remove orphaned layers from Docker daemon at the build time.

0 commit comments

Comments
 (0)