handson-ml/docker/Dockerfile

77 lines
2.8 KiB
Docker
Raw Normal View History

FROM continuumio/miniconda3:latest
RUN apt-get update && apt-get upgrade -y \
2017-12-11 22:02:42 +01:00
&& apt-get install -y \
libpq-dev \
build-essential \
git \
sudo \
cmake zlib1g-dev libjpeg-dev xvfb ffmpeg xorg-dev libboost-all-dev libsdl2-dev swig \
2019-06-04 10:43:14 +02:00
unzip zip \
2017-12-11 22:02:42 +01:00
&& rm -rf /var/lib/apt/lists/*
2018-03-02 18:44:05 +01:00
RUN conda update -n base conda
COPY docker/environment.yml /tmp/
RUN conda env create -f /tmp/environment.yml
ARG username
ARG userid
ARG home=/home/${username}
2019-06-04 10:43:14 +02:00
ARG workdir=${home}/handson-ml2
RUN adduser ${username} --uid ${userid} --gecos '' --disabled-password \
2017-12-11 22:02:42 +01:00
&& echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} \
&& chmod 0440 /etc/sudoers.d/${username}
WORKDIR ${workdir}
RUN chown ${username}:${username} ${workdir}
USER ${username}
2019-06-04 10:43:14 +02:00
WORKDIR ${workdir}
2019-06-04 10:43:14 +02:00
# The config below enables diffing notebooks with nbdiff (and nbdiff support
# in git diff command) after connecting to the container by "make exec" (or
# "docker-compose exec handson-ml2 bash")
# You may also try running:
2019-06-04 10:43:14 +02:00
# nbdiff NOTEBOOK_NAME.ipynb
# to get nbdiff between checkpointed version and current version of the
# given notebook.
RUN git-nbdiffdriver config --enable --global
# INFO: Optionally uncomment any (one) of the following RUN commands below to ignore either
# metadata or details in nbdiff within git diff
#RUN git config --global diff.jupyternotebook.command 'git-nbdiffdriver diff --ignore-metadata'
RUN git config --global diff.jupyternotebook.command 'git-nbdiffdriver diff --ignore-details'
COPY docker/bashrc.bash /tmp/
RUN cat /tmp/bashrc.bash >> ${home}/.bashrc
RUN echo "export PATH=\"${workdir}/docker/bin:$PATH\"" >> ${home}/.bashrc
RUN sudo rm /tmp/bashrc.bash
# INFO: Uncomment lines below to enable automatic save of python-only and html-only
# exports alongside the notebook
#COPY docker/jupyter_notebook_config.py /tmp/
#RUN cat /tmp/jupyter_notebook_config.py >> ${home}/.jupyter/jupyter_notebook_config.py
#RUN sudo rm /tmp/jupyter_notebook_config.py
2017-11-30 12:59:26 +01:00
2019-06-04 10:43:14 +02:00
# INFO: Uncomment the RUN command below to disable git diff paging
#RUN git config --global core.pager ''
2017-11-30 12:59:26 +01:00
2019-06-04 10:43:14 +02:00
# INFO: Uncomment the RUN command below for easy and constant notebook URL (just localhost:8888)
2019-06-04 10:43:14 +02:00
# That will switch Jupyter to using empty password instead of a token.
# To avoid making a security hole you SHOULD in fact not only uncomment but
# regenerate the hash for your own non-empty password and replace the hash below.
# You can compute a password hash in any notebook, just run the code:
# from notebook.auth import passwd
# passwd()
# and take the hash from the output
#RUN mkdir -p ${home}/.jupyter && \
2017-12-11 22:02:42 +01:00
# echo 'c.NotebookApp.password = u"sha1:c6bbcba2d04b:f969e403db876dcfbe26f47affe41909bd53392e"' \
# >> ${home}/.jupyter/jupyter_notebook_config.py