From 2e4a5147cb7a8b22a2eed5895b2799676eee9553 Mon Sep 17 00:00:00 2001 From: quackerd Date: Sun, 19 Jun 2022 22:13:09 -0400 Subject: [PATCH] docker update script --- docker_update.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docker_update.py b/docker_update.py index 7bb0fd9..64625f6 100644 --- a/docker_update.py +++ b/docker_update.py @@ -1,6 +1,8 @@ import os import sys +from numpy import full + if len(sys.argv) != 3: print("Invalid number of arguments\n") exit(1) @@ -11,19 +13,17 @@ spec_file = sys.argv[2] with open(spec_file,"r") as f: lines = f.readlines() -folders = [] for line in lines: s = line.strip() - folders.add(s) - print("Registered folder " + s) + fullpath = os.path.join(path, s) + if os.path.isdir(fullpath) and "docker-compose.yml" in os.listdir(fullpath): + print("========= Processing " + fullpath + " =========") + os.system("docker-compose -f " + fullpath + " pull") + os.system("docker-compose -f " + fullpath + " up -d") + else: + print("========= Skipping " + fullpath + ": invalid dir or docker-compos.yml =========") -for f in os.listdir(path): - fullpath = os.path.join(path,f) - if os.path.isdir(fullpath) and f in folders: - print("========= Processing " + fullpath + " =========") - os.system("docker-compose -f " + fullpath + " pull") - os.system("docker-compose -f " + fullpath + " up -d") print("========== CLEANING UP ==========") os.system("docker system prune -af")