-
Notifications
You must be signed in to change notification settings - Fork 3k
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
added onbuild container for datascience #152
Conversation
Very cool thought. Thanks for this. I wonder if we should put this in examples since it's not a stack we'd build and push to Docker Hub, but one a user would build him/herself. We can expand the readme to say that this really works for any of the stacks. The user just has to switch the What do you think? |
I think its a good a idea to put it on examples, but I still think it would be good it its build and pushed in dockerhub. For instance the way python-onbuild (https://hub.docker.com/_/python/) works, if you pull the onbuild image you don't have to write commands to copy your source code and install the requirements it would be done automatically on build Likewise I would like to just import a juypter datascience obuild container and during build it automatically adds my source code and installs my requirements What do you think? |
Looks cool. Like the idea. Probably could consider one using a conda environment file, as well. Sorry for this tedious detail, but would you mind adding terminal newlines to the ends of files. |
@@ -0,0 +1,8 @@ | |||
from jupyter/datascience-notebook |
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.
Probably should be capitalized (i.e. FROM
).
If we are going to build and deploy this along with other images, it will need to be moved up a directory and renamed to something unique. That or we will need to make some tweaks to the |
Might be worth including a trivial example of how this is used. |
sure let me do that |
Ah, yes, I forgot how ONBUILD works. Thanks for correcting me. Disregard my "move to examples" comment.
If this passes muster over time, we might end up having one of these per stack (
We could adapt the make process to test for the *.onbuild files (probably). |
@@ -0,0 +1,7 @@ | |||
FROM jupyter/datascience-notebook |
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.
Can you add the Jupyter copyright at the top of this file? You can copy/paste it from the other Dockerfiles.
Thanks @mwaaas. Few minor comments. |
@parente, I like your idea of having them in the same directory with extensions. Should we do that with this one or do you have some other thoughts about how it should be placed? Another thought occurs to me that having one with that uses conda and an |
Considering we're pretty much based on conda, both sounds good if it's possible to write the command so that if one or the other does not exist, the build doesn't fail. (Last I tried, the ADD/COPY require the files to be there and error if they're not.) Let's start with this one in the same folder with the naming if we're all agreed. For now, let's just do the |
So, I was suggesting that as we are adding the source directory that we just do that. Then it doesn't matter which files exists in it as far as the
Sounds good. Another thought. Currently, we are installing this into the Python 3 environment. Should there be some mechanism for selecting Python 2 or both? |
@parente @jakirkham |
|
||
ONBUILD COPY . /home/jovyan/work | ||
|
||
ONBUILD RUN [ -e requirements.txt ] && pip install --no-cache-dir -r requirements.txt |
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.
Probably should put in parentheses and add an || true
afterward to ensure the exit code is always 0
. So it would be...
( [ -e requirements.txt ] && pip install --no-cache-dir -r requirements.txt ) || true
@parente, any thoughts on the Python 2/3 issue? |
|
||
ONBUILD RUN [ -e requirements.txt ] && pip install --no-cache-dir -r requirements.txt | ||
|
||
ONBUILD RUN [ -e environment.yml ] && conda install --file environment.yml |
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.
Should there be a development install line somewhere (e.g. pip install -e /home/jovyan/work
)?
We also have to think about R which is in the datascience-notebook image and managed by conda. We don't necessarily have to implement support for installing to the R environment yet but we do have to leave room in our naming conventions for it later. How about:
with all this doc'ed in the README. |
@parente I agree with the naming convention to leave space for all environments quick question if I want to install to python2 do I need to activate the environment |
Yes. I think there's an example in the Dockerfile of this already. Something to the effect of:
|
what's the status of this PR ? |
Hi @mwaaas. Do you still plan to implement the support for the various requirement.txt files? If not, would you mind if we open a new PR starting from your branch with the extra commits implementing it and documenting it in the README? You'll still get credit for the work you did because your commits will be retained. |
@parente Hi sorry I had taken time to reply, will work on it this weekend |
@mwaaas No rush or problem at all! Take your time. |
Hi @mwaaas. This PR has been open for a long time. Sorry about that. Are you still interested in getting this merged? I think the most common pattern people are using is to define a Dockerfile that installs whatever they need starting |
I have added a container that has "ONBUILD" commands that: