kopia lustrzana https://github.com/jupyterhub/repo2docker
Merge pull request #68 from yuvipanda/print-dockerfile
Add --debug & --no-build optionspull/75/head
commit
8db1d43210
|
@ -144,6 +144,12 @@ class Repo2Docker(Application):
|
|||
help='Push docker image to repository'
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
'--debug',
|
||||
help="Turn on debug logging",
|
||||
action='store_true',
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
'--no-run',
|
||||
dest='run',
|
||||
|
@ -158,6 +164,13 @@ class Repo2Docker(Application):
|
|||
help="Don't clean up remote checkouts after we are done"
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
'--no-build',
|
||||
dest='build',
|
||||
action='store_false',
|
||||
help="Do not actually build the image. Useful in conjugation with --print-dockerfile."
|
||||
)
|
||||
|
||||
argparser.add_argument(
|
||||
'cmd',
|
||||
nargs='*',
|
||||
|
@ -169,6 +182,9 @@ class Repo2Docker(Application):
|
|||
def initialize(self):
|
||||
args = self.get_argparser().parse_args()
|
||||
|
||||
if args.debug:
|
||||
self.log_level = logging.DEBUG
|
||||
|
||||
self.load_config_file(args.config)
|
||||
|
||||
if os.path.exists(args.repo):
|
||||
|
@ -210,6 +226,12 @@ class Repo2Docker(Application):
|
|||
self.run = args.run
|
||||
self.json_logs = args.json_logs
|
||||
|
||||
self.build = args.build
|
||||
if not self.build:
|
||||
# Can't push nor run if we aren't building
|
||||
self.run = False
|
||||
self.push = False
|
||||
|
||||
self.run_cmd = args.cmd
|
||||
|
||||
|
||||
|
@ -296,17 +318,20 @@ class Repo2Docker(Application):
|
|||
picked_buildpack = bp
|
||||
break
|
||||
|
||||
self.log.info('Using %s builder\n', bp.name, extra=dict(phase='building'))
|
||||
for l in picked_buildpack.build(self.output_image_spec):
|
||||
if 'stream' in l:
|
||||
self.log.info(l['stream'], extra=dict(phase='building'))
|
||||
elif 'error' in l:
|
||||
self.log.info(l['error'], extra=dict(phase='failure'))
|
||||
sys.exit(1)
|
||||
elif 'status' in l:
|
||||
self.log.info('Fetching base image...\r', extra=dict(phase='building'))
|
||||
else:
|
||||
self.log.info(json.dumps(l), extra=dict(phase='building'))
|
||||
self.log.debug(picked_buildpack.render(), extra=dict(phase='building'))
|
||||
|
||||
if self.build:
|
||||
self.log.info('Using %s builder\n', bp.name, extra=dict(phase='building'))
|
||||
for l in picked_buildpack.build(self.output_image_spec):
|
||||
if 'stream' in l:
|
||||
self.log.info(l['stream'], extra=dict(phase='building'))
|
||||
elif 'error' in l:
|
||||
self.log.info(l['error'], extra=dict(phase='failure'))
|
||||
sys.exit(1)
|
||||
elif 'status' in l:
|
||||
self.log.info('Fetching base image...\r', extra=dict(phase='building'))
|
||||
else:
|
||||
self.log.info(json.dumps(l), extra=dict(phase='building'))
|
||||
|
||||
if self.cleanup_checkout:
|
||||
shutil.rmtree(checkout_path)
|
||||
|
|
Ładowanie…
Reference in New Issue