-
Notifications
You must be signed in to change notification settings - Fork 11
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 Dockerfile #235
Open
zenkavi
wants to merge
5
commits into
lnccbrown:main
Choose a base branch
from
zenkavi:add-dockerfile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
added Dockerfile #235
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8be1e32
added Dockerfile
zenkavi 09dcbdf
remove explicit dependencies and begun adding tests but they will not…
zenkavi 4d472e1
The parameter name seems to have changed in the multiple parameter re…
zenkavi 04e0727
simplified copying tutorials
zenkavi 9ea8045
updated dockerfile to remove tests and change path to new docs
zenkavi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) Jupyter Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
# To build using this image | ||
# docker build -t zenkavi/hssm:0.0.3 -f Dockerfile . | ||
|
||
# HSSM images built with this Dockerfile can be found at zenkavi/hssm | ||
# docker pull zenkavi/hssm | ||
|
||
ARG BASE_CONTAINER=jupyter/minimal-notebook:python-3.9 | ||
FROM $BASE_CONTAINER | ||
|
||
USER root | ||
|
||
# ffmpeg for matplotlib anim & dvipng for latex labels | ||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y build-essential && \ | ||
apt-get install -y --no-install-recommends apt-utils && \ | ||
apt-get install -y --no-install-recommends ffmpeg dvipng && \ | ||
apt install -y graphviz &&\ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
USER $NB_UID | ||
|
||
## TODO: Move these to a requirements.txt and install in a virtual env instead of as root | ||
RUN pip install --upgrade pip && \ | ||
pip install --no-cache-dir "pytest>=7.3.1" && \ | ||
pip install --no-cache-dir "black>=23.7.0" && \ | ||
pip install --no-cache-dir "mypy>=1.4.1" && \ | ||
pip install --no-cache-dir "pre-commit>=2.20.0" && \ | ||
pip install --no-cache-dir "jupyterlab>=4.0.2" && \ | ||
pip install --no-cache-dir "ipykernel>=6.16.0" && \ | ||
pip install --no-cache-dir "git+https://github.com/brown-ccv/hddm-wfpt.git" && \ | ||
pip install --no-cache-dir "ipywidgets>=8.0.3" && \ | ||
pip install --no-cache-dir "graphviz>=0.20.1" && \ | ||
pip install --no-cache-dir "ruff>=0.0.272" && \ | ||
pip install --no-cache-dir "numpyro>=0.12.1" && \ | ||
pip install --no-cache-dir "mkdocs>=1.4.3" && \ | ||
pip install --no-cache-dir "mkdocs-material>=9.1.17" && \ | ||
pip install --no-cache-dir "mkdocstrings-python>=1.1.2" && \ | ||
pip install --no-cache-dir "mkdocs-jupyter>=0.24.1" && \ | ||
# pip install --no-cache-dir "hssm>=0.1.2" && \ | ||
pip install git+https://github.com/lnccbrown/HSSM.git && \ | ||
fix-permissions "/home/${NB_USER}" | ||
|
||
|
||
# Import matplotlib the first time to build the font cache. | ||
ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/" | ||
|
||
RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" &&\ | ||
fix-permissions "/home/${NB_USER}" | ||
|
||
USER $NB_UID | ||
WORKDIR $HOME | ||
|
||
# Create a folder for example | ||
RUN mkdir -p /home/$NB_USER/docs/tutorials && \ | ||
mkdir -p /home/$NB_USER/docs/getting_started && \ | ||
fix-permissions /home/$NB_USER | ||
|
||
# Copy example data and scripts to the example folder | ||
COPY /docs/tutorials /home/${NB_USER}/docs/tutorials | ||
COPY /docs/getting_started /home/${NB_USER}/docs/getting_started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
could you try a minimal version here?
After installing the jupyterlab related stuff, pip install hssm (in the best case alone, but potentially with very few extra installs), should suffice.
I looks like you are manually installing a ton of dependencies that would be installed upon hssm install.
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.
(Admittedly I am no docker-expert, but this is what it looks like :))
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.
Makes sense. I'm not an expert either but I cleaned it up and made a new image and it seemed to work fine. I actually found another bug so it was good to review it again.
Before I send an updated PR though I had another question: how are the tests in the repo intended to be run? I used them to quickly check if the new image was working as expected. Do you use these internally ad hoc? Are they automated somehow with each build?
The only testing framework I've used in Python is unittest (https://docs.python.org/3/library/unittest.html#organizing-test-code). I can translate your tests and run them all when building an image. So if the tests are exhaustive then this would make sure that there wouldn't be an image with a broken version of hssm. The con for this is that each script in the tests directory would change slightly. But if you accept the format and adhere to it with future tests then they can always be run automatically with the same single command (
python -m unittest
).Alternatively tests can stay as they are and I can in effect loop through everything in the directory. So if you have another pipeline these are already seamlessly going through that would not be messed up. I don't have a preference either way.
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.
Thank you :).
As per Paul's answer below, I don't think you have to worry about running tests in the docker image. As long as you install from pip that is automatically guaranteed (but in fact since we run tests on every PR, the same is true if you install from the main branch on git, even though I would recommend pip).