kopia lustrzana https://github.com/jupyterhub/repo2docker
rodzic
ac700c49be
commit
a0ad3f92e3
|
@ -239,14 +239,13 @@ def make_r2d(argv=None):
|
|||
|
||||
r2d.json_logs = args.json_logs
|
||||
|
||||
r2d.build = args.build
|
||||
r2d.dry_run = not args.build
|
||||
|
||||
if not args.build:
|
||||
if r2d.dry_run:
|
||||
# Can't push nor run if we aren't building
|
||||
args.run = False
|
||||
args.push = False
|
||||
|
||||
r2d.build = args.build
|
||||
r2d.run = args.run
|
||||
r2d.push = args.push
|
||||
|
||||
|
|
|
@ -276,12 +276,10 @@ class Repo2Docker(Application):
|
|||
|
||||
# FIXME: Refactor class to be able to do --no-build without needing
|
||||
# deep support for it inside other code
|
||||
build = Bool(
|
||||
True,
|
||||
dry_run = Bool(
|
||||
False,
|
||||
help="""
|
||||
Actually build the docker image.
|
||||
|
||||
Can be set to false to do a dry run of rep2docker
|
||||
Do not actually build the docker image, just simulate it.
|
||||
""",
|
||||
config=True
|
||||
)
|
||||
|
@ -400,7 +398,7 @@ class Repo2Docker(Application):
|
|||
str(int(time.time()))
|
||||
)
|
||||
|
||||
if not self.build and (self.run or self.push):
|
||||
if self.dry_run and (self.run or self.push):
|
||||
raise ValueError("Can not push or run image if we are not building it")
|
||||
|
||||
if self.volumes and not self.run:
|
||||
|
@ -537,9 +535,12 @@ class Repo2Docker(Application):
|
|||
s.close()
|
||||
return port
|
||||
|
||||
def start(self):
|
||||
"""Start execution of repo2docker""" # Check if r2d can connect to docker daemon
|
||||
if self.build:
|
||||
def build(self):
|
||||
"""
|
||||
Build docker image
|
||||
"""
|
||||
# Check if r2d can connect to docker daemon
|
||||
if not self.dry_run:
|
||||
try:
|
||||
api_client = docker.APIClient(version='auto',
|
||||
**kwargs_from_env())
|
||||
|
@ -550,11 +551,6 @@ class Repo2Docker(Application):
|
|||
if self.log_level == logging.DEBUG:
|
||||
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
|
||||
|
@ -597,7 +593,7 @@ class Repo2Docker(Application):
|
|||
self.log.debug(picked_buildpack.render(),
|
||||
extra=dict(phase='building'))
|
||||
|
||||
if self.build:
|
||||
if not self.dry_run:
|
||||
build_args = {
|
||||
'NB_USER': self.user_name,
|
||||
'NB_UID': str(self.user_id)
|
||||
|
|
Ładowanie…
Reference in New Issue