Skip to content

Commit

Permalink
Make sure ENTRYPOINT is an absolute path
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yuvipanda committed Apr 30, 2019
1 parent 5e67e3c commit 4dd32f3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions repo2docker/buildpacks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4dd32f3

Please sign in to comment.