From 6aa8422994d93bff4f4835ec7bece200c80553f7 Mon Sep 17 00:00:00 2001 From: jowj Date: Fri, 4 May 2018 12:52:19 -0500 Subject: [PATCH] add build capability to script --- colove.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/colove.py b/colove.py index 7e776f5..2e96db1 100644 --- a/colove.py +++ b/colove.py @@ -1,4 +1,6 @@ import os +import sys +import argparse import subprocess import pdb @@ -19,5 +21,24 @@ def dockerrun( 'colove:latest'] subprocess.run(args) +def dockerbuild(): + args = [ + 'docker', 'build', + DOCKERDIR, + '--tag', + 'colove:latest'] + subprocess.run(args) + +def main(argv): + if argv == ['-r']: + dockerrun() + if argv == ['-b']: + dockerbuild() + if __name__ == '__main__': - dockerrun() \ No newline at end of file + parse = argparse.ArgumentParser(description='what docker operation do you want?') + parse.add_argument('-r','--run',help='runs the container',action='store_true') + parse.add_argument('-b','--build',help='builds the container',action='store_true') + + args = parse.parse_args() + main(sys.argv[1:])