forked from bluesky/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (44 loc) · 1.91 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
FROM jupyter/minimal-notebook
MAINTAINER NSLS-II <https://nsls-ii.github.io>
USER root
RUN apt update
RUN apt-get install --yes libgl1-mesa-glx
USER $NB_USER
ENV ENV_NAME tutorial
ENV PROFILE_NAME tutorial
RUN conda update conda
COPY environment.yml ./
RUN conda env create -n $ENV_NAME -f environment.yml && conda clean -yt
RUN rm environment.yml
COPY matplotlibrc $CONDA_DIR/envs/$ENV_NAME/lib/python3.5/site-packages/matplotlib/mpl-data/
# Copy NSLS-II tutorial notebooks.
COPY tutorial/ ./
# Copy upstream Jupyter's tutorials on using the notebook.
RUN mkdir jupyter-notebook-tutorial
COPY notebook/docs/source/examples/Notebook/* jupyter-notebook-tutorial/
# Copy scripts and create a hidden directory to hold sample data.
RUN mkdir /home/$NB_USER/.data-cache
RUN mkdir /home/$NB_USER/.amostra_files
RUN mkdir /home/$NB_USER/scripts
COPY scripts/* /home/$NB_USER/scripts/
# Add shortcuts to distinguish pip for python2 and python3 envs
RUN ln -s $CONDA_DIR/envs/python2/bin/pip $CONDA_DIR/bin/pip2 && \
ln -s $CONDA_DIR/bin/pip $CONDA_DIR/bin/pip3
# Import matplotlib the first time to build the font cache.
ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
RUN $CONDA_DIR/envs/$ENV_NAME/bin/python -c "import matplotlib.pyplot"
# Install kernel spec globally to avoid permission problems when NB_UID
# switching at runtime.
USER root
RUN $CONDA_DIR/envs/$ENV_NAME/bin/python -m ipykernel install
# Overwrite kernel.json with hand-rolled file that includes IPython profile.
COPY kernel.json /usr/local/share/jupyter/kernels/python3/kernel.json
USER $NB_USER
# Create an IPython profile and a file to startup.
RUN $CONDA_DIR/envs/$ENV_NAME/bin/ipython profile create $PROFILE_NAME
# Ensure $NB_USER has ownership of all files in home dir.
USER root
RUN chown -R $NB_USER /home/$NB_USER/
USER $NB_USER
ENV PATH $CONDA_DIR/envs/$ENV_NAME/bin:$PATH
# ENV PASSWORD meeting # Uncomment to turn on password for use during events. Also see Dockerfile.