From ac700c49be5d3aa3e0d2c279329bb25013c43624 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Tue, 11 Dec 2018 12:36:06 -0800 Subject: [PATCH] Split 'build' function out of start --- repo2docker/__main__.py | 13 ++++++++----- repo2docker/app.py | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/repo2docker/__main__.py b/repo2docker/__main__.py index e4a94fa3..05309a3f 100644 --- a/repo2docker/__main__.py +++ b/repo2docker/__main__.py @@ -237,15 +237,18 @@ def make_r2d(argv=None): if args.image_name: r2d.output_image_spec = args.image_name - r2d.push = args.push - r2d.run = args.run r2d.json_logs = args.json_logs r2d.build = args.build - if not r2d.build: + + if not args.build: # Can't push nor run if we aren't building - r2d.run = False - r2d.push = False + args.run = False + args.push = False + + r2d.build = args.build + r2d.run = args.run + r2d.push = args.push # check against r2d.run and not args.run as r2d.run is false on # --no-build diff --git a/repo2docker/app.py b/repo2docker/app.py index fddfd6ba..c97896ef 100644 --- a/repo2docker/app.py +++ b/repo2docker/app.py @@ -551,6 +551,10 @@ class Repo2Docker(Application): raise e sys.exit(1) + def build(self): + """ + Build docker image + """ # If the source to be executed is a directory, continue using the # directory. In the case of a local directory, it is used as both the # source and target. Reusing a local directory seems better than @@ -620,6 +624,9 @@ class Repo2Docker(Application): if self.cleanup_checkout: shutil.rmtree(checkout_path, ignore_errors=True) + def start(self): + self.build() + if self.push: self.push_image()