Skip to content

Instantly share code, notes, and snippets.

@portnov
Last active June 21, 2016 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save portnov/47ddca24fb90ed18f531972d0510420d to your computer and use it in GitHub Desktop.
Save portnov/47ddca24fb90ed18f531972d0510420d to your computer and use it in GitHub Desktop.
Jupyter with FriCAS, Maxima, R, Octave, Haskell, Python
$ sudo apt-get install -y docker.io
$ docker build -t jupyter .
# drink a cup of tea, then eat lunch, then walk your dog, then...
$ docker run --name jupyter -d -p 8888:8888 -v ~/notebooks:/notebooks jupyter
$ x-www-browser http://localhost:8888
FROM ubuntu:16.04
MAINTAINER Ilya Portnov <portnov@iportnov.ru>
#RUN DEBIAN_FRONTEND=noninteractive locale-gen en_US.UTF-8 && \
# DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales
# Not essential, but wise to set the lang # Note: Users with other languages should set this in their derivative image
#ENV LANGUAGE en_US.UTF-8
#ENV LANG en_US.UTF-8
#ENV LC_ALL en_US.UTF-8
#ENV PYTHONIOENCODING UTF-8
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
ca-certificates \
curl wget \
git subversion \
language-pack-en \
libcurl4-openssl-dev \
libffi-dev \
libsqlite3-dev \
libzmq3-dev \
pandoc \
python \
python3 \
python-dev \
python3-dev \
python-pip \
python3-pip \
sqlite3 \
zlib1g-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
texlive-fonts-recommended \
texlive-latex-base \
texlive-latex-extra
# Install Tini
RUN curl -L https://github.com/krallin/tini/releases/download/v0.6.0/tini > tini && \
echo "d5ed732199c36a1189320e6c4859f0169e950692f451c03e7854243b95f4234b *tini" | sha256sum -c - && \
mv tini /usr/local/bin/tini && \
chmod +x /usr/local/bin/tini
# Install some dependencies.
RUN apt-get install -y python-setuptools python3-setuptools && \
pip2 --no-cache-dir install ipykernel && \
pip3 --no-cache-dir install ipykernel && \
python2 -m ipykernel.kernelspec && \
python3 -m ipykernel.kernelspec && \
pip2 install notebook && \
pip3 install notebook && \
pip2 install --no-cache-dir widgetsnbextension && \
pip3 install --no-cache-dir widgetsnbextension
# Default notebook profile.
RUN mkdir -p -m 700 /root/.jupyter/ && \
echo "c.NotebookApp.ip = '*'" >> /root/.jupyter/jupyter_notebook_config.py
# Install older sbcl & dependencies
RUN apt-get install -y sbcl \
autoconf libgmp-dev
# Download & build sbcl 1.3.6
RUN cd /usr/src/ && \
wget http://prdownloads.sourceforge.net/sbcl/sbcl-1.3.6-source.tar.bz2?download && \
tar xf sbcl-1.3.6-source.tar.bz2\?download && \
cd sbcl-1.3.6 && \
bash make.sh && \
bash install.sh
# download & build fricas
RUN cd /usr/src/ && \
svn checkout svn://svn.code.sf.net/p/fricas/code/trunk fricas && \
cd fricas/ && \
./build-setup.sh && \
./configure --enable-gmp && \
make -j4 && \
make install
ENV SBCL_HOME /usr/local/lib/sbcl
# download & build fricas_jupyter
RUN cd /usr/src/ && \
git clone https://github.com/nilqed/fricas_jupyter.git && \
cd fricas_jupyter && \
./install.sh
# install octave
RUN apt-get install -y --no-install-recommends octave gnuplot-nox && \
pip2 install octave_kernel && \
pip3 install octave_kernel && \
python2 -m octave_kernel.install && \
python3 -m octave_kernel.install
RUN pip2 install ipywidgets && \
pip3 install ipywidgets
# install ihaskell
RUN apt-get install -y ghc cabal-install alex happy cpphs pkg-config && \
cabal update && \
cabal install cryptonite ihaskell --reorder-goals --ghc-options=-opta-Wa,-mrelax-relocations=no && \
ln ~/.cabal/bin/ihaskell /usr/local/bin/ && \
ihaskell install
# install ihaskell-diagrams
RUN apt-get install -y --no-install-recommends libgtk2.0-dev && \
cabal install --ghc-options=-opta-Wa,-mrelax-relocations=no gtk2hs-buildtools && \
ln ~/.cabal/bin/gtk* /usr/local/bin/ && \
cabal install --ghc-options=-opta-Wa,-mrelax-relocations=no diagrams diagrams-cairo && \
cabal install --ghc-options=-opta-Wa,-mrelax-relocations=no ihaskell-diagrams
# install maxima
RUN cd /usr/src/ && \
wget 'http://downloads.sourceforge.net/project/maxima/Maxima-source/5.38.1-source/maxima-5.38.1.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fmaxima%2Ffiles%2FMaxima-source%2F5.38.1-source%2F&ts=1466440822&use_mirror=heanet' -O maxima.tar.gz && \
tar xf maxima.tar.gz && \
cd maxima-5.38.1/ && \
./configure && \
make -j4 && \
make install
RUN apt-get install -y cl-quicklisp
WORKDIR /usr/src/
RUN /bin/echo -e '(load #p"/usr/share/cl-quicklisp/quicklisp.lisp")\n\
(quicklisp-quickstart:install)' > install-quicklisp.lisp && \
sbcl --script install-quicklisp.lisp && \
git clone https://github.com/robert-dodier/maxima-jupyter && \
cd maxima-jupyter && \
/bin/echo -e "parse_string(\"1\");\n\
:lisp (load \"/usr/local/lib/sbcl/contrib/sb-rotate-byte.fasl\")\n\
:lisp (load \"/root/quicklisp/setup.lisp\")\n\
:lisp (loop for system in (list :uiop :asdf :sb-posix) do (asdf:operate 'asdf:load-op system))\n\
:lisp (load \"/usr/src/maxima-jupyter/load-maxima-jupyter.lisp\")\n\
:lisp (sb-ext:save-lisp-and-die \"maxima-jupyter.core\" :toplevel 'cl-jupyter:kernel-start :executable t)\n\
quit();\n" > build-core.maxima && \
cat build-core.maxima && \
maxima -b=build-core.maxima && \
python3 install-maxima-jupyter.py --maxima-jupyter-exec=$(pwd)/maxima-jupyter.core
# install R
RUN apt-get install -y r-recommended r-cran-ggplot2 libssh2-1-dev libssl-dev
# install R for jupyter (IRkernel)
RUN /bin/echo -e "install.packages(c('repr', 'pbdZMQ', 'devtools'), repos='http://cran.us.r-project.org')\n\
devtools::install_github('IRkernel/IRdisplay')\n\
devtools::install_github('IRkernel/IRkernel')\n\
IRkernel::installspec()\n" > install.R && \
R -f install.R
VOLUME /notebooks
VOLUME /root/.jupyter
WORKDIR /notebooks
EXPOSE 8888
ENTRYPOINT ["tini", "--"]
CMD ["jupyter", "notebook", "--no-browser"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment