Skip to content

Instantly share code, notes, and snippets.

@rokinmaharjan
Last active October 23, 2018 06:40
Show Gist options
  • Select an option

  • Save rokinmaharjan/409a67813795122b002fe21839269ab8 to your computer and use it in GitHub Desktop.

Select an option

Save rokinmaharjan/409a67813795122b002fe21839269ab8 to your computer and use it in GitHub Desktop.
Base image for ML
# Build as jupyterhub/singleuser
# Run with the DockerSpawner in JupyterHub
ARG BASE_IMAGE=fusemachinesinc/fusemachines-base-notebook
FROM $BASE_IMAGE
MAINTAINER Fusemachines <info@fusemachines.com>
ADD install_jupyterhub /tmp/install_jupyterhub
ARG JUPYTERHUB_VERSION=master
USER root
# install pinned jupyterhub and ensure notebook is installed
RUN python3 /tmp/install_jupyterhub && \
python3 -m pip install notebook
# Install all OS dependencies for fully functional notebook server
RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \
emacs \
git \
inkscape \
jed \
libsm6 \
libxext-dev \
libxrender1 \
lmodern \
netcat \
pandoc \
python-dev \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-base \
texlive-latex-extra \
texlive-xetex \
unzip \
nano \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
ADD ./notebook/templates /opt/conda/lib/python3.6/site-packages/notebook/templates
USER $NB_UID
USER root
# Install all OS dependencies for fully functional notebook server
RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \
emacs \
git \
inkscape \
jed \
libsm6 \
libxext-dev \
libxrender1 \
lmodern \
netcat \
pandoc \
python-dev \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-generic-recommended \
texlive-latex-base \
texlive-latex-extra \
texlive-xetex \
unzip \
nano \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Switch back to fusemachines to avoid accidental container runs as root
USER $NB_UID
USER root
# ffmpeg for matplotlib anim
RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER $NB_UID
# Install Python 3 packages
# Remove pyqt and qt pulled in for matplotlib since we're only ever going to
# use notebook-friendly backends in these images
RUN conda install --quiet --yes \
'conda-forge::blas=*=openblas' \
'ipywidgets=7.2*' \
'pandas=0.23*' \
'numexpr=2.6*' \
'matplotlib=2.2*' \
'scipy=1.1*' \
'seaborn=0.9*' \
'scikit-learn=0.19*' \
'scikit-image=0.14*' \
'sympy=1.1*' \
'cython=0.28*' \
'patsy=0.5*' \
'statsmodels=0.9*' \
'cloudpickle=0.5*' \
'dill=0.2*' \
'numba=0.38*' \
'bokeh=0.12*' \
'sqlalchemy=1.2*' \
'hdf5=1.10*' \
'h5py=2.7*' \
'vincent=0.4.*' \
'beautifulsoup4=4.6.*' \
'protobuf=3.*' \
'xlrd' && \
conda remove --quiet --yes --force qt pyqt && \
conda clean -tipsy
# 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
# Install Tensorflow
RUN conda install --quiet --yes \
'tensorflow=1.5*' \
'keras=2.1*' && \
conda clean -tipsy && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
# Install Opencv
RUN conda install -c conda-forge opencv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment