|
1 | | -FROM ubuntu:16.04 |
| 1 | +ARG device |
| 2 | +ARG username="jovyan" |
| 3 | + |
| 4 | +FROM ubuntu:18.04 AS base-cpu |
| 5 | + |
| 6 | +FROM nvidia/cuda:10.2-base-ubuntu18.04 AS base-gpu |
| 7 | + |
| 8 | +FROM base-$device AS base |
| 9 | + |
| 10 | +ARG username |
| 11 | +ENV DEBIAN_FRONTEND=noninteractive |
| 12 | + |
| 13 | +RUN apt-get -qq update && \ |
| 14 | + apt-get install -y wget unzip git cmake xvfb sudo freeglut3-dev ffmpeg |
| 15 | + |
| 16 | +RUN adduser --disabled-password --gecos "Default user" $username && \ |
| 17 | + adduser $username sudo && \ |
| 18 | + echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ |
| 19 | + mkdir /notebooks && \ |
| 20 | + chown -R $username /notebooks |
| 21 | + |
| 22 | +RUN su $username -c \ |
| 23 | + "wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh \ |
| 24 | + -O /tmp/anaconda3.sh" && \ |
| 25 | + mkdir -p /opt/conda && \ |
| 26 | + chown -R $username /opt/conda && \ |
| 27 | + su $username -c "/bin/bash /tmp/anaconda3.sh -b -p /opt/conda -u" && \ |
| 28 | + rm /tmp/anaconda3.sh && \ |
| 29 | + ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ |
| 30 | + su $username -c "echo '. /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc" && \ |
| 31 | + su $username -c "echo 'conda activate base' >> ~/.bashrc" |
| 32 | + |
| 33 | +ADD deeplearning.yaml /tmp/deeplearning-template.yaml |
| 34 | + |
| 35 | +USER $username |
| 36 | +SHELL ["/bin/bash", "-i", "-c"] |
| 37 | +RUN conda install -y jupyter |
| 38 | + |
| 39 | +FROM base AS stage-cpu |
| 40 | +RUN sed -e "s/{tensorflow}/tensorflow/g" -e "s/{pytorch}/pytorch/g" /tmp/deeplearning-template.yaml > /tmp/deeplearning.yaml |
| 41 | + |
| 42 | +FROM base AS stage-gpu |
| 43 | +RUN sed -e "s/{tensorflow}/tensorflow-gpu/g" -e "s/{pytorch}/pytorch-gpu/g" /tmp/deeplearning-template.yaml > /tmp/deeplearning.yaml |
| 44 | + |
| 45 | +FROM stage-$device as final |
| 46 | + |
2 | 47 | LABEL maintainer "Alexander Panin <[email protected]>, Dmitry Mittov <[email protected]>" |
3 | 48 |
|
| 49 | +ARG username |
| 50 | +USER $username |
| 51 | +SHELL ["/bin/bash", "-i", "-c"] |
4 | 52 |
|
5 | | -RUN echo "deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ |
6 | | - apt-get -qq update && \ |
7 | | - apt-get install -y cmake \ |
8 | | - wget \ |
9 | | - unzip \ |
10 | | - git \ |
11 | | - zlib1g-dev \ |
12 | | - libjpeg-dev \ |
13 | | - xvfb \ |
14 | | - libav-tools \ |
15 | | - xorg-dev \ |
16 | | - python-opengl \ |
17 | | - swig3.0 \ |
18 | | - python-dev \ |
19 | | - python3-dev \ |
20 | | - python-pip \ |
21 | | - python3-pip \ |
22 | | - libopenblas-dev \ |
23 | | - liblapack-dev \ |
24 | | - libsdl2-dev \ |
25 | | - libboost-all-dev \ |
26 | | - graphviz \ |
27 | | - gcc \ |
28 | | - g++ && \ |
29 | | - ln -s /usr/bin/swig3.0 /usr/bin/swig |
30 | | - |
31 | | -RUN pip install --upgrade pip==9.0.3 && \ |
32 | | - pip install --upgrade numpy scipy && \ |
33 | | - pip install --upgrade sklearn \ |
34 | | - jupyter \ |
35 | | - tqdm \ |
36 | | - graphviz \ |
37 | | - gym gym[box2d] gym[atari] \ |
38 | | - matplotlib \ |
39 | | - seaborn && \ |
40 | | - pip install --upgrade https://github.com/Theano/Theano/archive/master.zip \ |
41 | | - https://github.com/Lasagne/Lasagne/archive/master.zip \ |
42 | | - https://github.com/yandexdataschool/AgentNet/archive/master.zip \ |
43 | | - tensorflow \ |
44 | | - https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp27-cp27mu-linux_x86_64.whl \ |
45 | | - torchvision \ |
46 | | - keras |
47 | | - |
48 | | -RUN pip install --upgrade gym_pull ppaquette-gym-doom |
49 | | - |
50 | | - |
51 | | -RUN pip3 install --upgrade pip==9.0.3 && \ |
52 | | - pip3 install --upgrade numpy scipy && \ |
53 | | - pip3 install --upgrade sklearn \ |
54 | | - jupyter \ |
55 | | - tqdm \ |
56 | | - graphviz \ |
57 | | - gym gym[box2d] gym[atari] \ |
58 | | - matplotlib \ |
59 | | - seaborn && \ |
60 | | - pip3 install --upgrade https://github.com/Theano/Theano/archive/master.zip \ |
61 | | - https://github.com/Lasagne/Lasagne/archive/master.zip \ |
62 | | - https://github.com/yandexdataschool/AgentNet/archive/master.zip \ |
63 | | - https://download.pytorch.org/whl/cpu/torch-1.0.1.post2-cp35-cp35m-linux_x86_64.whl \ |
64 | | - torchvision \ |
65 | | - tensorflow \ |
66 | | - keras && \ |
67 | | - python3 -m ipykernel.kernelspec |
| 53 | +RUN conda env create -f /tmp/deeplearning.yaml && \ |
| 54 | + conda activate deeplearning && \ |
| 55 | + python -m ipykernel install --user --name python3 --display-name "Python 3" |
68 | 56 |
|
| 57 | +RUN sudo rm /tmp/deeplearning*.yaml |
69 | 58 |
|
70 | 59 | EXPOSE 8888 |
71 | 60 | VOLUME /notebooks |
72 | 61 | WORKDIR /notebooks |
| 62 | +ENV PATH /opt/conda/bin:$PATH |
73 | 63 |
|
74 | 64 | COPY run_jupyter.sh / |
75 | 65 | CMD ["/run_jupyter.sh"] |
0 commit comments