From 4dd32f3563bebcab75a5877712c07355205d6d40 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Mon, 29 Apr 2019 21:42:29 -0700 Subject: [PATCH] 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. --- repo2docker/buildpacks/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/repo2docker/buildpacks/base.py b/repo2docker/buildpacks/base.py index 265c49c0e..8616dbd08 100644 --- a/repo2docker/buildpacks/base.py +++ b/repo2docker/buildpacks/base.py @@ -668,7 +668,12 @@ def get_post_build_scripts(self): return [] def get_start_script(self): - start = self.binder_path('./start') + start = self.binder_path('start') if os.path.exists(start): - return start + # Return an absolute path to start + # This is important when built container images start with + # a working directory that is different from ${REPO_DIR} + # This isn't a problem with anything else, since start is + # the only path evaluated at container start time rather than build time + return os.path.join('${REPO_DIR}', start) return None