diff --git a/publish_images.py b/publish_images.py index c32156b51c653ef2ce97c1f78c601d41520b46dc..3f35b94b77d23d16cc0ce12b67efb8177c46e359 100755 --- a/publish_images.py +++ b/publish_images.py @@ -14,6 +14,16 @@ def main(): for idx, fname in enumerate(dockerfiles): progress = "({}/{})".format(idx + 1, n_files) + print('-' * 79) + print("{} Checking for existing '{}'".format(progress, fname)) + pull_cmd = ("docker pull {0}/{1}".format(REGISTRY_URL, fname)) + child = sp.Popen( + pull_cmd, shell=True, stdout=sys.stdout, stderr=sp.PIPE) + child.communicate() + if child.returncode > 0: + print(" -> no image found for '{}', starting from scratch.". + format(fname)) + print('-' * 79) print("{} Building '{}'".format(progress, fname)) build_cmd = ("docker build --pull -t {0}/{1} -f {1} . ".format( @@ -28,5 +38,6 @@ def main(): push_cmd, shell=True, stdout=sys.stdout, stderr=sys.stderr) child.communicate() + if __name__ == '__main__': main()