diff --git a/update.py b/update.py index cae387c..96be066 100755 --- a/update.py +++ b/update.py @@ -5,10 +5,12 @@ from subprocess import call from datetime import datetime from typing import List +KEEP_DAYS = 3 def main(): build_images() update_containers() + prune() def build_images(): @@ -37,6 +39,10 @@ def read_file(path: Path) -> List[str]: return elements +def prune(): + hours = int(KEEP_DAYS * 24) + call(['docker', 'system', 'prune', '--all', '--force', '--filter', f'until={hours}h']) + if __name__ == "__main__": main()