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.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
|
# Can't push nor run if we aren't building
|
||||||
args.run = False
|
args.run = False
|
||||||
args.push = False
|
args.push = False
|
||||||
|
|
||||||
r2d.build = args.build
|
|
||||||
r2d.run = args.run
|
r2d.run = args.run
|
||||||
r2d.push = args.push
|
r2d.push = args.push
|
||||||
|
|
||||||
|
|
|
@ -276,12 +276,10 @@ class Repo2Docker(Application):
|
||||||
|
|
||||||
# FIXME: Refactor class to be able to do --no-build without needing
|
# FIXME: Refactor class to be able to do --no-build without needing
|
||||||
# deep support for it inside other code
|
# deep support for it inside other code
|
||||||
build = Bool(
|
dry_run = Bool(
|
||||||
True,
|
False,
|
||||||
help="""
|
help="""
|
||||||
Actually build the docker image.
|
Do not actually build the docker image, just simulate it.
|
||||||
|
|
||||||
Can be set to false to do a dry run of rep2docker
|
|
||||||
""",
|
""",
|
||||||
config=True
|
config=True
|
||||||
)
|
)
|
||||||
|
@ -400,7 +398,7 @@ class Repo2Docker(Application):
|
||||||
str(int(time.time()))
|
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")
|
raise ValueError("Can not push or run image if we are not building it")
|
||||||
|
|
||||||
if self.volumes and not self.run:
|
if self.volumes and not self.run:
|
||||||
|
@ -537,9 +535,12 @@ class Repo2Docker(Application):
|
||||||
s.close()
|
s.close()
|
||||||
return port
|
return port
|
||||||
|
|
||||||
def start(self):
|
def build(self):
|
||||||
"""Start execution of repo2docker""" # Check if r2d can connect to docker daemon
|
"""
|
||||||
if self.build:
|
Build docker image
|
||||||
|
"""
|
||||||
|
# Check if r2d can connect to docker daemon
|
||||||
|
if not self.dry_run:
|
||||||
try:
|
try:
|
||||||
api_client = docker.APIClient(version='auto',
|
api_client = docker.APIClient(version='auto',
|
||||||
**kwargs_from_env())
|
**kwargs_from_env())
|
||||||
|
@ -550,11 +551,6 @@ class Repo2Docker(Application):
|
||||||
if self.log_level == logging.DEBUG:
|
if self.log_level == logging.DEBUG:
|
||||||
raise e
|
raise e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def build(self):
|
|
||||||
"""
|
|
||||||
Build docker image
|
|
||||||
"""
|
|
||||||
# If the source to be executed is a directory, continue using the
|
# 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
|
# directory. In the case of a local directory, it is used as both the
|
||||||
# source and target. Reusing a local directory seems better than
|
# source and target. Reusing a local directory seems better than
|
||||||
|
@ -597,7 +593,7 @@ class Repo2Docker(Application):
|
||||||
self.log.debug(picked_buildpack.render(),
|
self.log.debug(picked_buildpack.render(),
|
||||||
extra=dict(phase='building'))
|
extra=dict(phase='building'))
|
||||||
|
|
||||||
if self.build:
|
if not self.dry_run:
|
||||||
build_args = {
|
build_args = {
|
||||||
'NB_USER': self.user_name,
|
'NB_USER': self.user_name,
|
||||||
'NB_UID': str(self.user_id)
|
'NB_UID': str(self.user_id)
|
||||||
|
|
Ładowanie…
Reference in New Issue