add: pruning
This commit is contained in:
@@ -5,10 +5,12 @@ from subprocess import call
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
KEEP_DAYS = 3
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
build_images()
|
build_images()
|
||||||
update_containers()
|
update_containers()
|
||||||
|
prune()
|
||||||
|
|
||||||
|
|
||||||
def build_images():
|
def build_images():
|
||||||
@@ -37,6 +39,10 @@ def read_file(path: Path) -> List[str]:
|
|||||||
return elements
|
return elements
|
||||||
|
|
||||||
|
|
||||||
|
def prune():
|
||||||
|
hours = int(KEEP_DAYS * 24)
|
||||||
|
call(['docker', 'system', 'prune', '--all', '--force', '--filter', f'until={hours}h'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user