-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let CMD <cmd>
in the Dockerfile template be configurable
#957
Changes from all commits
9a806c7
e21086e
f0a3fb0
f7ec92e
4ff3a78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -191,7 +191,7 @@ | |||||||||||||||||||||||||||||||
ENTRYPOINT ["/usr/local/bin/repo2docker-entrypoint"] | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# Specify the default command to run | ||||||||||||||||||||||||||||||||
CMD ["jupyter", "notebook", "--ip", "0.0.0.0"] | ||||||||||||||||||||||||||||||||
CMD {{ command }} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
{% if appendix -%} | ||||||||||||||||||||||||||||||||
# Appendix: | ||||||||||||||||||||||||||||||||
|
@@ -482,6 +482,14 @@ def get_start_script(self): | |||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||
return None | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
def get_command(self): | ||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||
The default command to be run by docker. | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
This should return a list of strings to be used as Dockerfile `CMD`. | ||||||||||||||||||||||||||||||||
Comment on lines
+485
to
+489
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||
return ["jupyter", "notebook", "--ip", "0.0.0.0"] | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
@property | ||||||||||||||||||||||||||||||||
def binder_dir(self): | ||||||||||||||||||||||||||||||||
has_binder = os.path.isdir("binder") | ||||||||||||||||||||||||||||||||
|
@@ -554,6 +562,19 @@ def render(self): | |||||||||||||||||||||||||||||||
for k, v in self.get_build_script_files().items() | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
# If get_command returns a list or a tuple, it will be stringified (exec form). | ||||||||||||||||||||||||||||||||
# If it returns a string, it will be used as is (shell form). | ||||||||||||||||||||||||||||||||
cmd = self.get_command() | ||||||||||||||||||||||||||||||||
if isinstance(cmd, tuple): | ||||||||||||||||||||||||||||||||
cmd = list(cmd) | ||||||||||||||||||||||||||||||||
if isinstance(cmd, list): | ||||||||||||||||||||||||||||||||
cmd = str(cmd).replace("'", '"') | ||||||||||||||||||||||||||||||||
if not isinstance(cmd, str): | ||||||||||||||||||||||||||||||||
raise ValueError( | ||||||||||||||||||||||||||||||||
'Method "get_command" of buildpack "%s" must return a string, a list or a tuple.' | ||||||||||||||||||||||||||||||||
% self.__class__.__name__ | ||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||
Comment on lines
+565
to
+576
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't understand what is going on with regards to the replacement operation that remains, but I suspect its not reasonable to provide either. |
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
return t.render( | ||||||||||||||||||||||||||||||||
packages=sorted(self.get_packages()), | ||||||||||||||||||||||||||||||||
path=self.get_path(), | ||||||||||||||||||||||||||||||||
|
@@ -568,6 +589,7 @@ def render(self): | |||||||||||||||||||||||||||||||
base_packages=sorted(self.get_base_packages()), | ||||||||||||||||||||||||||||||||
post_build_scripts=self.get_post_build_scripts(), | ||||||||||||||||||||||||||||||||
start_script=self.get_start_script(), | ||||||||||||||||||||||||||||||||
command=cmd, | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
appendix=self.appendix, | ||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.