Files
docker-stacks/pyspark-notebook/Dockerfile
Peter Parente d25f33a5fb Fix py4j version and path
(c) Copyright IBM Corp. 2016
2016-02-04 21:29:36 -05:00

72 lines
2.5 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
# Util to help with kernel spec later
RUN apt-get -y update && apt-get -y install jq
# Spark dependencies
ENV APACHE_SPARK_VERSION 1.6.0
RUN apt-get -y update && \
apt-get install -y --no-install-recommends openjdk-7-jre-headless && \
apt-get clean
RUN cd /tmp && \
wget -q http://d3kbcqa49mib13.cloudfront.net/spark-${APACHE_SPARK_VERSION}-bin-hadoop2.6.tgz && \
echo "439fe7793e0725492d3d36448adcd1db38f438dd1392bffd556b58bb9a3a2601 *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
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
# Spark and Mesos pointers
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
USER jovyan
# Install Python 3 packages
RUN conda install --yes \
'ipywidgets=4.0*' \
'pandas=0.17*' \
'matplotlib=1.4*' \
'scipy=0.16*' \
'seaborn=0.6*' \
'scikit-learn=0.16*' \
&& conda clean -yt
# Install Python 2 packages and kernel spec
RUN conda create -p $CONDA_DIR/envs/python2 python=2.7 \
'ipython=4.0*' \
'ipywidgets=4.0*' \
'pandas=0.17*' \
'matplotlib=1.4*' \
'scipy=0.16*' \
'seaborn=0.6*' \
'scikit-learn=0.16*' \
pyzmq \
&& conda clean -yt
# 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