kopia lustrzana https://github.com/jupyterhub/repo2docker
Do not require postBuild to be executable
This is hard for windows users and from the GitHub UI, and provides dubious benefits. So let's remove the requirement! Fixes #240pull/241/head
rodzic
2485e9836c
commit
01bb6d1e19
|
@ -3,7 +3,6 @@ import jinja2
|
||||||
import tarfile
|
import tarfile
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import stat
|
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import docker
|
import docker
|
||||||
|
@ -107,15 +106,14 @@ LABEL {{k}}={{v}}
|
||||||
# We always want containers to run as non-root
|
# We always want containers to run as non-root
|
||||||
USER ${NB_USER}
|
USER ${NB_USER}
|
||||||
|
|
||||||
|
# Make sure that postBuild scripts are marked executable before executing them
|
||||||
{% if post_build_scripts -%}
|
{% if post_build_scripts -%}
|
||||||
{% for s in post_build_scripts -%}
|
{% for s in post_build_scripts -%}
|
||||||
RUN ./{{ s }}
|
RUN chmod +x {{ s }} && ./{{ s }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DOC_URL = "http://repo2docker.readthedocs.io/en/latest/samples.html"
|
|
||||||
|
|
||||||
|
|
||||||
class BuildPack:
|
class BuildPack:
|
||||||
"""
|
"""
|
||||||
|
@ -409,9 +407,5 @@ class BaseImage(BuildPack):
|
||||||
def get_post_build_scripts(self):
|
def get_post_build_scripts(self):
|
||||||
post_build = self.binder_path('postBuild')
|
post_build = self.binder_path('postBuild')
|
||||||
if os.path.exists(post_build):
|
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 [post_build]
|
||||||
return []
|
return []
|
||||||
|
|
|
@ -4,16 +4,4 @@ System - Post-build scripts
|
||||||
It is possible to run scripts after you've built the environment specified in
|
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
|
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
|
some configuration scripts. For example, this will download and install a
|
||||||
Jupyter extension.
|
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
|
|
Ładowanie…
Reference in New Issue