mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 15:02:57 +00:00

base-notebook defines environment variables for the Conda install path and the notebook user. However, in some instances, these locations were still hardcoded. Let’s use the variables instead.
84 lines
3.2 KiB
Docker
84 lines
3.2 KiB
Docker
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
FROM jupyter/minimal-notebook
|
|
|
|
MAINTAINER Jupyter Project <jupyter@googlegroups.com>
|
|
|
|
USER root
|
|
|
|
# Spark dependencies
|
|
ENV APACHE_SPARK_VERSION 1.6.1
|
|
RUN apt-get -y update && \
|
|
apt-get install -y --no-install-recommends openjdk-7-jre-headless && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
RUN cd /tmp && \
|
|
wget -q http://d3kbcqa49mib13.cloudfront.net/spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6.tgz && \
|
|
echo "09f3b50676abc9b3d1895773d18976953ee76945afa72fa57e6473ce4e215970 *spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6.tgz" | sha256sum -c - && \
|
|
tar xzf spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6.tgz -C /usr/local && \
|
|
rm spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6.tgz
|
|
RUN cd /usr/local && ln -s spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6 spark
|
|
|
|
# Mesos dependencies
|
|
# Currently, Mesos is not available from Debian Jessie.
|
|
# So, we are installing it from Debian Wheezy. Once it
|
|
# becomes available for Debian Jessie. We should switch
|
|
# over to using that instead.
|
|
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF && \
|
|
DISTRO=debian && \
|
|
CODENAME=wheezy && \
|
|
echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" > /etc/apt/sources.list.d/mesosphere.list && \
|
|
apt-get -y update && \
|
|
apt-get --no-install-recommends -y --force-yes install mesos=0.22.1-1.0.debian78 && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Spark and Mesos config
|
|
ENV SPARK_HOME /usr/local/spark
|
|
ENV PYTHONPATH $SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.9-src.zip
|
|
ENV MESOS_NATIVE_LIBRARY /usr/local/lib/libmesos.so
|
|
ENV SPARK_OPTS --driver-java-options=-Xms1024M --driver-java-options=-Xmx4096M --driver-java-options=-Dlog4j.logLevel=info
|
|
|
|
USER $NB_USER
|
|
|
|
# Install Python 3 packages
|
|
RUN conda install --quiet --yes \
|
|
'ipywidgets=5.1*' \
|
|
'pandas=0.17*' \
|
|
'numexpr=2.5*' \
|
|
'matplotlib=1.5*' \
|
|
'scipy=0.17*' \
|
|
'seaborn=0.7*' \
|
|
'scikit-learn=0.17*' \
|
|
jq \
|
|
&& conda clean -tipsy
|
|
# Activate ipywidgets extension in the environment that runs the notebook server
|
|
RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix
|
|
|
|
# Install Python 2 packages and kernel spec
|
|
RUN conda create --quiet --yes -p $CONDA_DIR/envs/python2 python=2.7 \
|
|
'ipython=4.2*' \
|
|
'ipywidgets=5.1*' \
|
|
'pandas=0.17*' \
|
|
'numexpr=2.5*' \
|
|
'matplotlib=1.5*' \
|
|
'scipy=0.17*' \
|
|
'seaborn=0.7*' \
|
|
'scikit-learn=0.17*' \
|
|
pyzmq \
|
|
&& conda clean -tipsy
|
|
# 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
|
|
|
|
# Install Python 2 kernel spec into the Python 3 conda environment which
|
|
# runs the notebook server
|
|
RUN bash -c '. activate python2 && \
|
|
python -m ipykernel.kernelspec --prefix=$CONDA_DIR && \
|
|
. deactivate'
|
|
# Set PYSPARK_HOME in the python2 spec
|
|
RUN jq --arg v "$CONDA_DIR/envs/python2/bin/python" \
|
|
'.["env"]["PYSPARK_PYTHON"]=$v' \
|
|
$CONDA_DIR/share/jupyter/kernels/python2/kernel.json > /tmp/kernel.json && \
|
|
mv /tmp/kernel.json $CONDA_DIR/share/jupyter/kernels/python2/kernel.json
|