Skip to content

Instantly share code, notes, and snippets.

@tscholl2
Last active January 19, 2018 19:59
Show Gist options
  • Save tscholl2/5abebac13cc6db88d75b072d4b11ee82 to your computer and use it in GitHub Desktop.
Save tscholl2/5abebac13cc6db88d75b072d4b11ee82 to your computer and use it in GitHub Desktop.
sage in docker with extras
FROM sagemath/sagemath:8.0-2
ARG SAGE_BRANCH=master
EXPOSE 8888
RUN echo && \
# update system
apt-get update && apt-get install -y && \
# install some dependencies for gifs and animations
apt-get install -y imagemagick ffmpeg && \
# install tex
apt-get install -y texlive-full && \
apt-get purge -f -y make-doc \
texlive-fonts-extra-doc \
texlive-fonts-recommended-doc \
texlive-humanities-doc \
texlive-latex-base-doc \
texlive-latex-extra-doc \
texlive-latex-recommended-doc \
texlive-metapost-doc \
texlive-pictures-doc \
texlive-pstricks-doc \
texlive-science-doc &&\
apt-get clean &&\
apt-get autoclean -y &&\
apt-get autoremove -y --purge &&\
apt-get clean &&\
rm -rf /tmp/* /var/tmp/* &&\
# add sudo
echo 'sage ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/sage
# install tqdm and other useful tools
USER sage
RUN sage -pip install --upgrade pip \
&& /usr/bin/sage -i \
database_jones_numfield \
database_cremona_ellcurve \
database_gap \
database_pari \
pari_jupyter \
pari_galdata \
pari_seadata_small \
cypari \
&& /usr/bin/sage -p kash3-2008-07-31.p0.spkg \
&& sage -pip install tqdm jupyterthemes
# for jupyter themes use:
# jupyter-theme -t oceans16 -fs 12 -f roboto -N
ENV JUPYTER_CONFIG_DIR /home/sage/stuff/.jupyter
# TODO: change sage user UID to match UID of files on disc so mounting works better
USER root
ENTRYPOINT sage -n jupyter --no-browser --ip=$(grep `hostname` /etc/hosts | cut -f1) --port=8888 --allow-root
# build with
# docker build -t my-own-docker-sage .
# run with
# docker run --name sage --memory=4g --rm -it -p 127.0.0.1:8888:8888 -v /home/traviss/.../stuff:/home/sage/stuff my-own-docker-sage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment