Skip to content

Commit

Permalink
⚡️(tilt) clean automatically old images
Browse files Browse the repository at this point in the history
Tilt live updates generate a new image for each change, ending up storing
a lot of images when you are really developing with Tilt.

I have not found a built-in way of cleaning old images from Tilt documentation,
I create a utility doing the dirty work.
  • Loading branch information
lebaudantoine committed Feb 24, 2025
1 parent 25506b6 commit 054e7ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
load('ext://uibutton', 'cmd_button', 'bool_input', 'location')
load('ext://namespace', 'namespace_create', 'namespace_inject')
namespace_create('meet')

def clean_old_images(image_name):
local('docker images -q %s | tail -n +2 | xargs -r docker rmi' % image_name)

docker_build(
'localhost:5001/meet-backend:latest',
context='..',
Expand All @@ -15,6 +19,7 @@ docker_build(
)
]
)
clean_old_images('localhost:5001/meet-backend')

docker_build(
'localhost:5001/meet-frontend:latest',
Expand All @@ -26,6 +31,7 @@ docker_build(
sync('../src/frontend', '/home/frontend'),
]
)
clean_old_images('localhost:5001/meet-frontend')

docker_build(
'localhost:5001/meet-summary:latest',
Expand All @@ -37,6 +43,7 @@ docker_build(
sync('../src/summary', '/home/summary'),
]
)
clean_old_images('localhost:5001/meet-summary')

k8s_yaml(local('cd ../src/helm && helmfile -n meet -e ${DEV_ENV:-dev} template .'))

Expand Down

0 comments on commit 054e7ba

Please sign in to comment.