Skip to content

Commit

Permalink
Improve logging. Fix cleanup in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rnc authored and goldmann committed Nov 13, 2024
1 parent 6690fde commit 8492058
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docker_squash/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ def _before_squashing(self):
try:
number_of_layers = int(self.from_layer)

self.log.debug("We detected number of layers as the argument to squash")
self.log.debug(
f"We detected number of layers ({number_of_layers}) as the argument to squash"
)
except ValueError:
self.log.debug("We detected layer as the argument to squash")

squash_id = self._squash_id(self.from_layer)
self.log.debug(f"We detected layer ({squash_id}) as the argument to squash")

if not squash_id:
raise SquashError(
Expand Down
7 changes: 5 additions & 2 deletions docker_squash/squash.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ def squash(self, image: Image):
# Load squashed image into Docker
image.load_squashed_image()

# Clean up all temporary files
image.cleanup()
# If development mode is not enabled, make sure we clean up the
# temporary directory
if not self.development:
# Clean up all temporary files
image.cleanup()

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

0 comments on commit 8492058

Please sign in to comment.