|
1 | | -# Install Ubuntu 18.04 |
2 | | -# Other supported cuda images: https://hub.docker.com/r/nvidia/cuda/ |
3 | | -FROM nvidia/cuda:10.0-runtime-ubuntu18.04 |
4 | | - |
5 | | -# Install basic dependencies |
6 | | -RUN apt-get update |
7 | | -RUN apt-get install -y python3 python3-pip wget |
8 | | - |
9 | | -# OpenCV dependencies |
10 | | -RUN apt-get install -y libglib2.0-0 |
11 | | - |
12 | | -# MPI dependencies |
13 | | -RUN apt-get install -y ssh |
14 | | -RUN wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.2.tar.gz |
15 | | -RUN tar -xvf openmpi-3.1.2.tar.gz |
16 | | -WORKDIR /openmpi-3.1.2 |
17 | | -RUN ./configure |
18 | | -RUN make -j 8 install |
19 | | -WORKDIR / |
20 | | - |
21 | | -# Gym dependencies |
22 | | -RUN apt-get install -y cmake zlib1g-dev libjpeg-dev |
23 | | - |
24 | | -# PyTorch 1.0 |
25 | | -RUN pip3 install https://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.whl |
26 | | - |
27 | | -# Set Python 3 as the default |
28 | | -RUN ln -s /usr/bin/python3 /usr/bin/python |
29 | | - |
30 | | -# Install AdeptRL |
31 | | -COPY ./ /adeptRL |
32 | | -WORKDIR /adeptRL |
33 | | -RUN pip3 install .[all] |
| 1 | +# Copyright (C) 2020 Heron Systems, Inc. |
| 2 | +# |
| 3 | +# This Dockerfile builds an image that: |
| 4 | +# (1) installs all dependencies that should be necessary to develop and run |
| 5 | +# code for the current project. |
| 6 | +# |
| 7 | +# (2) supports persistence across Docker runs. After running connect.py for |
| 8 | +# the first time, you should notice a new folder /mnt/users/yourusername, |
| 9 | +# both on your host machine as well as your Docker instance. All files |
| 10 | +# that you wish to persist should be stored under folder. For convenience, |
| 11 | +# this Dockerfile sets up zsh under /mnt/users/yourusername and symlinks |
| 12 | +# necessary files to /home/yoursername (in the Docker instance) such that |
| 13 | +# history persists (so, ctrl-p works across Docker runs). |
| 14 | +# |
| 15 | +# Rather than running your own docker commands, it's recommended that you set |
| 16 | +# up a docker image via the connect.py script. You'll almost always want to |
| 17 | +# run something like: |
| 18 | +# |
| 19 | +# python connect.py --dockerfile ./Dockerfile --username gburdell \ |
| 20 | +# --email gburdell@heronsystems.com \ |
| 21 | +# --fullname "George P. Burdell" |
| 22 | +# |
| 23 | +# It's important to ensure that username, email, and fullname all match across |
| 24 | +# all Docker instances that you wish to all be associated with the same user |
| 25 | +# for persistence reasons. |
| 26 | +FROM nvidia/cudagl:10.1-devel-ubuntu18.04 |
| 27 | + |
| 28 | +ARG USERNAME |
| 29 | +ARG EMAIL |
| 30 | +ARG FULLNAME |
| 31 | + |
| 32 | +RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \ |
| 33 | + PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \ |
| 34 | + GIT_CLONE="git clone --depth 10" && \ |
| 35 | + rm -rf /var/lib/apt/lists/* \ |
| 36 | + /etc/apt/sources.list.d/cuda.list \ |
| 37 | + /etc/apt/sources.list.d/nvidia-ml.list && \ |
| 38 | + apt-get update && \ |
| 39 | +# ================================================================== |
| 40 | +# tools |
| 41 | +# ------------------------------------------------------------------ |
| 42 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 43 | + build-essential \ |
| 44 | + ca-certificates \ |
| 45 | + cmake \ |
| 46 | + curl \ |
| 47 | + git \ |
| 48 | + less \ |
| 49 | + openssh-server \ |
| 50 | + sudo \ |
| 51 | + systemd \ |
| 52 | + tmux \ |
| 53 | + unzip \ |
| 54 | + vim \ |
| 55 | + wget \ |
| 56 | + zsh && \ |
| 57 | +# ================================================================== |
| 58 | +# useful developer tools |
| 59 | +# ------------------------------------------------------------------ |
| 60 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 61 | + software-properties-common \ |
| 62 | + && \ |
| 63 | + add-apt-repository ppa:deadsnakes/ppa && \ |
| 64 | + apt-get update && \ |
| 65 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 66 | + python3.6 \ |
| 67 | + python3.6-dev \ |
| 68 | + python3.6-tk \ |
| 69 | + python3-distutils \ |
| 70 | + cython \ |
| 71 | + libopenmpi-dev \ |
| 72 | + openmpi-bin \ |
| 73 | + libsm6 \ |
| 74 | + libxext6 \ |
| 75 | + libxrender-dev \ |
| 76 | + locales \ |
| 77 | + mesa-utils |
| 78 | + |
| 79 | +# ================================================================== |
| 80 | +# Python goodies |
| 81 | +# ------------------------------------------------------------------ |
| 82 | +RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \ |
| 83 | + PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \ |
| 84 | + GIT_CLONE="git clone --depth 10" && \ |
| 85 | + rm -rf /var/lib/apt/lists/* \ |
| 86 | + /etc/apt/sources.list.d/cuda.list \ |
| 87 | + /etc/apt/sources.list.d/nvidia-ml.list && \ |
| 88 | + apt-get update && \ |
| 89 | + wget -O ~/get-pip.py \ |
| 90 | + https://bootstrap.pypa.io/get-pip.py && \ |
| 91 | + python3.6 ~/get-pip.py && \ |
| 92 | + ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \ |
| 93 | + ln -s /usr/bin/python3.6 /usr/local/bin/python && \ |
| 94 | + $PIP_INSTALL \ |
| 95 | + setuptools \ |
| 96 | + && \ |
| 97 | + $PIP_INSTALL \ |
| 98 | + cloudpickle==1.4.1 \ |
| 99 | + cmake==3.15.3 \ |
| 100 | + Cython==0.29.13 \ |
| 101 | + deepdiff==4.3.2 \ |
| 102 | + defusedxml==0.6.0 \ |
| 103 | + flake8==3.7.8 \ |
| 104 | + glances==3.1.4.1 \ |
| 105 | + h5py==2.10.0 \ |
| 106 | + imagesize==1.1.0 \ |
| 107 | + ipdb==0.13.2 \ |
| 108 | + jupyter==1.0.0 \ |
| 109 | + magicattr==0.1.4 \ |
| 110 | + matplotlib==3.1.1 \ |
| 111 | + numpy==1.17.2 \ |
| 112 | + opencv-python==4.1.1.26 \ |
| 113 | + ordered-set==3.1.1 \ |
| 114 | + pandas==0.25.1 \ |
| 115 | + Pillow==6.1.0 \ |
| 116 | + protobuf==3.9.2 \ |
| 117 | + pycodestyle==2.5.0 \ |
| 118 | + pyflakes==2.1.1 \ |
| 119 | + ray==0.8.5 \ |
| 120 | + scipy==1.3.1 \ |
| 121 | + six==1.12.0 \ |
| 122 | + scikit-learn==0.20.1 \ |
| 123 | + scikit-optimize==0.7.4 \ |
| 124 | + tabulate==0.8.7 \ |
| 125 | + tensorboard==1.14.0 \ |
| 126 | + tensorflow==1.14.0 \ |
| 127 | + tensorboardX==2.0 \ |
| 128 | + threadpoolctl==2.0.0 \ |
| 129 | + torch==1.5.0 \ |
| 130 | + torchvision==0.6.0 \ |
| 131 | + tqdm==4.43.0 |
| 132 | + |
| 133 | +# ================================================================== |
| 134 | +# cuDNN |
| 135 | +# ================================================================== |
| 136 | +RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \ |
| 137 | + rm -rf /var/lib/apt/lists/* \ |
| 138 | + /etc/apt/sources.list.d/cuda.list \ |
| 139 | + /etc/apt/sources.list.d/nvidia-ml.list && \ |
| 140 | + apt-get update && \ |
| 141 | + mkdir -p /opt/cudnn7 && \ |
| 142 | + cd /opt/cudnn7/ && \ |
| 143 | + wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb && \ |
| 144 | + dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb && \ |
| 145 | + apt-get update && \ |
| 146 | + $APT_INSTALL libcudnn7-dev && \ |
| 147 | + ldconfig && \ |
| 148 | + apt-get clean && \ |
| 149 | + apt-get autoremove && \ |
| 150 | + rm -rf /var/lib/apt/lists/* /tmp/* ~/* |
| 151 | + |
| 152 | +# ================================================================== |
| 153 | +# OpenAI Gym |
| 154 | +# ------------------------------------------------------------------ |
| 155 | +# Dependencies for OpenAI Gym |
| 156 | +RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \ |
| 157 | + PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \ |
| 158 | + rm -rf /var/lib/apt/lists/* \ |
| 159 | + /etc/apt/sources.list.d/cuda.list \ |
| 160 | + /etc/apt/sources.list.d/nvidia-ml.list && \ |
| 161 | + apt-get update && \ |
| 162 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 163 | + ffmpeg \ |
| 164 | + libosmesa6-dev \ |
| 165 | + libsdl2-dev \ |
| 166 | + patchelf \ |
| 167 | + python-pyglet \ |
| 168 | + python3-opengl \ |
| 169 | + swig \ |
| 170 | + xvfb && \ |
| 171 | + $PIP_INSTALL \ |
| 172 | + atari-py==0.2.6 \ |
| 173 | + box2d==2.3.10 \ |
| 174 | + cffi==1.14.0 \ |
| 175 | + glfw==1.11.0 \ |
| 176 | + pybullet==2.7.2 \ |
| 177 | + gym==0.14.0 |
| 178 | + |
| 179 | +# ================================================================== |
| 180 | +# matplotlib display dependencies |
| 181 | +# ------------------------------------------------------------------ |
| 182 | +RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \ |
| 183 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 184 | + tcl-dev \ |
| 185 | + tk-dev \ |
| 186 | + python-tk \ |
| 187 | + python3-tk && \ |
| 188 | + ln -fs /usr/share/zoneinfo/US/Eastern /etc/localtime && \ |
| 189 | + dpkg-reconfigure --frontend noninteractive tzdata && \ |
| 190 | + ldconfig && \ |
| 191 | + apt-get clean && \ |
| 192 | + apt-get autoremove && \ |
| 193 | + rm -rf /var/lib/apt/lists/* /tmp/* ~/* |
| 194 | + |
| 195 | +# ================================================================== |
| 196 | +# user setup |
| 197 | +# ------------------------------------------------------------------ |
| 198 | +# Create a user and enable passwordless sudo |
| 199 | +RUN useradd -m --shell /bin/zsh -r $USERNAME -u 1000 && \ |
| 200 | + echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" | sudo EDITOR="tee -a" visudo |
| 201 | + |
| 202 | +USER $USERNAME |
| 203 | + |
| 204 | +# prezto |
| 205 | +RUN cd /home/$USERNAME && \ |
| 206 | + git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto" && \ |
| 207 | + echo $'#!/bin/zsh\nsetopt EXTENDED_GLOB\nfor rcfile in ${ZDOTDIR:-$HOME}/.zprezto/runcoms/^README.md(.N); do\n ln -s $rcfile ${ZDOTDIR:-$HOME}/.${rcfile:t}\ndone\n' > .zsetup && \ |
| 208 | + zsh .zsetup && \ |
| 209 | +# fzf |
| 210 | + git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \ |
| 211 | + printf "y\ny\ny\n" | ~/.fzf/install |
| 212 | + |
| 213 | +# RUN locale-gen en_US.UTF-8 |
| 214 | +ENV LC_ALL=C.UTF-8 |
| 215 | +ENV LANG=C.UTF-8 |
| 216 | +ENV LANGUAGE=en_US.UTF-8 |
| 217 | + |
| 218 | +ENV DBUS_FATAL_WARNINGS=0 |
| 219 | + |
| 220 | +ENV USERNAME=$USERNAME |
| 221 | +ENV EMAIL=$EMAIL |
| 222 | +ENV FULLNAME=$FULLNAME |
| 223 | + |
| 224 | +ADD startup.sh /home/$USERNAME/startup.sh |
| 225 | +ENTRYPOINT ["/bin/zsh", "-c", "cd /home/${USERNAME}; zsh -c 'sh /home/$USERNAME/startup.sh; rm -f /home/$USERNAME/startup.sh; tmux;'"] |
0 commit comments