Skip to content

Commit 4dd32f3

Browse files
committed
Make sure ENTRYPOINT is an absolute path
Unlike other parts of the generated Dockerfile, the start script is evaluated at run time, rather than at build time. Currently, we assume that the current working directory is the same at runtime as build time for the start script. This doesn't hold true always, and particularly not in JupyterHub environments where ${HOME} is often overlaid with a persistent directory. We change this to always refer to the full path, using the ${REPO_DIR} environment variable. This lets people building JupyterHub images to set REPO_DIR to something like /srv/repo (like hubploy does), and still have a working start script.
1 parent 5e67e3c commit 4dd32f3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

repo2docker/buildpacks/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,12 @@ def get_post_build_scripts(self):
668668
return []
669669

670670
def get_start_script(self):
671-
start = self.binder_path('./start')
671+
start = self.binder_path('start')
672672
if os.path.exists(start):
673-
return start
673+
# Return an absolute path to start
674+
# This is important when built container images start with
675+
# a working directory that is different from ${REPO_DIR}
676+
# This isn't a problem with anything else, since start is
677+
# the only path evaluated at container start time rather than build time
678+
return os.path.join('${REPO_DIR}', start)
674679
return None

0 commit comments

Comments
 (0)