diff --git a/repo2docker/buildpacks/base.py b/repo2docker/buildpacks/base.py index 6dd8839b..99868acf 100644 --- a/repo2docker/buildpacks/base.py +++ b/repo2docker/buildpacks/base.py @@ -3,7 +3,6 @@ import jinja2 import tarfile import io import os -import stat import re import logging import docker @@ -107,15 +106,14 @@ LABEL {{k}}={{v}} # We always want containers to run as non-root USER ${NB_USER} +# Make sure that postBuild scripts are marked executable before executing them {% if post_build_scripts -%} {% for s in post_build_scripts -%} -RUN ./{{ s }} +RUN chmod +x {{ s }} && ./{{ s }} {% endfor %} {% endif -%} """ -DOC_URL = "http://repo2docker.readthedocs.io/en/latest/samples.html" - class BuildPack: """ @@ -409,9 +407,5 @@ class BaseImage(BuildPack): def get_post_build_scripts(self): post_build = self.binder_path('postBuild') if os.path.exists(post_build): - if not stat.S_IXUSR & os.stat(post_build).st_mode: - raise ValueError("%s is not executable, see %s for help." % ( - post_build, - DOC_URL+'#system-post-build-scripts')) return [post_build] return [] diff --git a/tests/venv/postBuild/README.rst b/tests/venv/postBuild/README.rst index 296f5541..f57e58d8 100644 --- a/tests/venv/postBuild/README.rst +++ b/tests/venv/postBuild/README.rst @@ -4,16 +4,4 @@ System - Post-build scripts It is possible to run scripts after you've built the environment specified in your other files. This could be used to, for example, download data or run some configuration scripts. For example, this will download and install a -Jupyter extension. - -.. note:: - - This file needs to be executable in order to work with ``repo2docker``. If - you're on Linux or macOS, run:: - - chmod +x postBuild - - If you're on windows, you can accomplish the same behavior with this - ``git`` command:: - - git update-index --chmod=+x postBuild +Jupyter extension. \ No newline at end of file