kopia lustrzana https://github.com/jupyterhub/repo2docker
rodzic
64bf17513f
commit
65c89e1f61
|
@ -145,7 +145,7 @@ class Repo2Docker(Application):
|
||||||
|
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
'repo',
|
'repo',
|
||||||
help='Path to repository that should be built'
|
help='Path to repository that should be built. Could be local path or a git URL.'
|
||||||
)
|
)
|
||||||
|
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
|
@ -153,6 +153,11 @@ class Repo2Docker(Application):
|
||||||
help='Name of image to be built. If unspecified will be autogenerated'
|
help='Name of image to be built. If unspecified will be autogenerated'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
argparser.add_argument(
|
||||||
|
'--ref',
|
||||||
|
help='If building a git url, which ref to check out'
|
||||||
|
)
|
||||||
|
|
||||||
argparser.add_argument(
|
argparser.add_argument(
|
||||||
'--push',
|
'--push',
|
||||||
dest='push',
|
dest='push',
|
||||||
|
@ -180,11 +185,15 @@ class Repo2Docker(Application):
|
||||||
|
|
||||||
self.load_config_file(args.config)
|
self.load_config_file(args.config)
|
||||||
|
|
||||||
if '@' in args.repo:
|
if os.path.exists(args.repo):
|
||||||
self.repo, self.ref = args.repo.split('@', 1)
|
# Let's treat this as a local directory we are building
|
||||||
else:
|
self.repo_type = 'local'
|
||||||
self.repo = args.repo
|
self.repo = args.repo
|
||||||
self.ref = None
|
self.ref = None
|
||||||
|
else:
|
||||||
|
self.repo_type = 'remote'
|
||||||
|
self.repo = args.repo
|
||||||
|
self.ref = args.ref
|
||||||
|
|
||||||
if args.json_logs:
|
if args.json_logs:
|
||||||
# Need to reset existing handlers, or we repeat messages
|
# Need to reset existing handlers, or we repeat messages
|
||||||
|
@ -207,7 +216,7 @@ class Repo2Docker(Application):
|
||||||
else:
|
else:
|
||||||
# Attempt to set a sane default!
|
# Attempt to set a sane default!
|
||||||
# HACK: Provide something more descriptive?
|
# HACK: Provide something more descriptive?
|
||||||
self.output_image_spec = 'image-' + escapism.escape(self.repo).lower()
|
self.output_image_spec = 'r2d' + escapism.escape(self.repo, escape_char='-').lower() + str(int(time.time()))
|
||||||
|
|
||||||
self.push = args.push
|
self.push = args.push
|
||||||
self.run = args.run
|
self.run = args.run
|
||||||
|
@ -278,6 +287,9 @@ class Repo2Docker(Application):
|
||||||
return port
|
return port
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
if self.repo_type == 'local':
|
||||||
|
checkout_path = self.repo
|
||||||
|
else:
|
||||||
checkout_path = os.path.join(self.git_workdir, str(uuid.uuid4()))
|
checkout_path = os.path.join(self.git_workdir, str(uuid.uuid4()))
|
||||||
self.fetch(
|
self.fetch(
|
||||||
self.repo,
|
self.repo,
|
||||||
|
@ -302,7 +314,7 @@ class Repo2Docker(Application):
|
||||||
else:
|
else:
|
||||||
raise Exception("No builder found!")
|
raise Exception("No builder found!")
|
||||||
|
|
||||||
if self.cleanup_checkout:
|
if self.repo_type != 'local' and self.cleanup_checkout:
|
||||||
shutil.rmtree(checkout_path)
|
shutil.rmtree(checkout_path)
|
||||||
|
|
||||||
if self.push:
|
if self.push:
|
||||||
|
|
Ładowanie…
Reference in New Issue