2019-10-13 15:56:08 +02:00
|
|
|
FROM continuumio/miniconda3:latest
|
2017-11-21 20:24:43 +01:00
|
|
|
|
2021-03-06 07:51:19 +01:00
|
|
|
RUN apt-get update && apt-get install -y \
|
2017-12-11 22:02:42 +01:00
|
|
|
build-essential \
|
2021-03-03 10:19:27 +01:00
|
|
|
cmake \
|
|
|
|
ffmpeg \
|
2017-12-11 22:02:42 +01:00
|
|
|
git \
|
2021-03-03 10:19:27 +01:00
|
|
|
libboost-all-dev \
|
|
|
|
libjpeg-dev \
|
|
|
|
libpq-dev \
|
|
|
|
libsdl2-dev swig \
|
2017-12-11 22:02:42 +01:00
|
|
|
sudo \
|
2021-03-03 10:19:27 +01:00
|
|
|
unzip \
|
|
|
|
xorg-dev \
|
|
|
|
xvfb \
|
|
|
|
zip \
|
|
|
|
zlib1g-dev \
|
2021-03-06 07:51:19 +01:00
|
|
|
&& apt clean \
|
2017-12-11 22:02:42 +01:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2017-11-27 17:16:51 +01:00
|
|
|
|
2019-11-05 09:27:33 +01:00
|
|
|
COPY environment.yml /tmp/
|
2021-03-06 07:51:19 +01:00
|
|
|
RUN echo ' - pyvirtualdisplay' >> /tmp/environment.yml \
|
2019-11-05 09:27:33 +01:00
|
|
|
&& conda env create -f /tmp/environment.yml \
|
2021-03-06 07:51:19 +01:00
|
|
|
&& conda clean -afy \
|
|
|
|
&& find /opt/conda/ -follow -type f -name '*.a' -delete \
|
|
|
|
&& find /opt/conda/ -follow -type f -name '*.pyc' -delete \
|
|
|
|
&& find /opt/conda/ -follow -type f -name '*.js.map' -delete \
|
2019-11-05 09:27:33 +01:00
|
|
|
&& rm /tmp/environment.yml
|
2017-11-27 17:16:51 +01:00
|
|
|
|
|
|
|
ARG username
|
2017-11-28 10:33:20 +01:00
|
|
|
ARG userid
|
2017-11-27 17:16:51 +01:00
|
|
|
|
2017-12-04 11:33:16 +01:00
|
|
|
ARG home=/home/${username}
|
2021-11-23 03:42:16 +01:00
|
|
|
ARG workdir=${home}/handson-ml3
|
2017-12-04 11:33:16 +01:00
|
|
|
|
2017-11-29 16:20:07 +01:00
|
|
|
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}
|
2017-11-27 17:16:51 +01:00
|
|
|
|
2017-11-30 12:09:16 +01:00
|
|
|
WORKDIR ${workdir}
|
|
|
|
RUN chown ${username}:${username} ${workdir}
|
2017-11-27 17:16:51 +01:00
|
|
|
|
|
|
|
USER ${username}
|
2019-06-04 10:43:14 +02:00
|
|
|
WORKDIR ${workdir}
|
2017-11-27 17:16:51 +01:00
|
|
|
|
2019-11-05 09:27:33 +01:00
|
|
|
ENV PATH /opt/conda/envs/tf2/bin:$PATH
|
|
|
|
|
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
|
2021-11-23 03:42:16 +01:00
|
|
|
# "docker-compose exec handson-ml3 bash")
|
2017-12-01 10:56:36 +01:00
|
|
|
# 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.
|
2017-11-21 20:24:43 +01:00
|
|
|
|
2017-11-29 16:20:07 +01:00
|
|
|
RUN git-nbdiffdriver config --enable --global
|
|
|
|
|
2017-12-01 10:56:36 +01:00
|
|
|
# INFO: Optionally uncomment any (one) of the following RUN commands below to ignore either
|
2017-11-30 12:09:16 +01:00
|
|
|
# metadata or details in nbdiff within git diff
|
2017-11-29 16:20:07 +01:00
|
|
|
#RUN git config --global diff.jupyternotebook.command 'git-nbdiffdriver diff --ignore-metadata'
|
2017-12-01 10:56:36 +01:00
|
|
|
RUN git config --global diff.jupyternotebook.command 'git-nbdiffdriver diff --ignore-details'
|
2017-11-30 12:09:16 +01:00
|
|
|
|
|
|
|
|
2017-12-11 16:19:24 +01:00
|
|
|
COPY docker/bashrc.bash /tmp/
|
2019-11-05 09:27:33 +01:00
|
|
|
RUN cat /tmp/bashrc.bash >> ${home}/.bashrc \
|
|
|
|
&& echo "export PATH=\"${workdir}/docker/bin:$PATH\"" >> ${home}/.bashrc \
|
|
|
|
&& sudo rm /tmp/bashrc.bash
|
2017-12-11 16:19:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
2017-12-01 10:56:36 +01: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
|
|
|
|
2017-12-01 10:56:36 +01: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.
|
2017-12-01 10:56:36 +01:00
|
|
|
# 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
|
2017-12-04 11:33:16 +01:00
|
|
|
#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
|