dockerutils/docker_update.py

34 lines
862 B
Python
Raw Normal View History

2022-06-20 02:06:30 +00:00
import os
import sys
2022-06-20 02:13:09 +00:00
from numpy import full
2022-06-20 02:06:30 +00:00
if len(sys.argv) != 3:
print("Invalid number of arguments\n")
exit(1)
path = sys.argv[1]
spec_file = sys.argv[2]
with open(spec_file,"r") as f:
lines = f.readlines()
for line in lines:
s = line.strip()
2022-06-20 02:13:09 +00:00
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 =========")
2022-06-20 02:06:30 +00:00
print("========== CLEANING UP ==========")
os.system("docker system prune -af")
os.system("echo $(date)")
os.system("echo \"Docker update finished!\"")
os.system("echo \"\"")