-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDocker.deep_learning
293 lines (221 loc) · 8.78 KB
/
Docker.deep_learning
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# From:
# https://raw.githubusercontent.com/ufoym/deepo/master/docker/Dockerfile.all-py36-cu90
#
# ==================================================================
# module list
# ------------------------------------------------------------------
# python 3.6 (apt)
# tensorflow latest (pip)
# theano latest (git)
# keras latest (pip)
# opencv 3.4.3 (git)
# ==================================================================
#
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
ENV http_proxy=http://ccanet\\xgsa0020:Thisisour35characterpasswordforthehallway!@secproxy.rockwellcollins.com:9090
ENV https_proxy=http://ccanet\\xgsa0020:Thisisour35characterpasswordforthehallway!@secproxy.rockwellcollins.com:9090
ENV APT_INSTALL="apt-get install -y --no-install-recommends"
ENV PIP_INSTALL="python -m pip --no-cache-dir install --upgrade"
ENV GIT_CLONE="git clone --depth 10"
RUN echo "Acquire::http::Proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/01proxy
RUN echo "Acquire::http::No-Cache true; Acquire::http::Pipeline-Depth 0;" >> /etc/apt/apt.conf.d/01proxy
RUN echo "Acquire::https::Proxy \"${https_proxy}\";" >> /etc/apt/apt.conf.d/01proxy
RUN echo "Acquire::https::No-Cache true; Acquire::https::Pipeline-Depth 0;" >> /etc/apt/apt.conf.d/01proxy
RUN cat /etc/apt/apt.conf.d/01proxy
RUN rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
apt-get update
# ==================================================================
# tools
# ------------------------------------------------------------------
RUN DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
ca-certificates \
cmake \
wget \
git \
vim
# ==================================================================
# python
# ------------------------------------------------------------------
RUN DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
software-properties-common
RUN echo deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main > /etc/apt/sources.list.d/deadsnakes-ppa-trusty.list
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
python3.6 \
python3.6-dev
RUN wget -O ~/get-pip.py \
https://bootstrap.pypa.io/get-pip.py && \
python3.6 ~/get-pip.py && \
ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.6 /usr/local/bin/python && \
$PIP_INSTALL \
setuptools
RUN $PIP_INSTALL \
numpy \
scipy \
pandas \
cloudpickle \
scikit-learn \
matplotlib \
Cython
# ==================================================================
# boost
# ------------------------------------------------------------------
RUN wget -O ~/boost.tar.gz https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz && \
tar -zxf ~/boost.tar.gz -C ~ && \
cd ~/boost_* && \
./bootstrap.sh --with-python=python3.6 && \
./b2 install --prefix=/usr/local
# ==================================================================
# tensorflow
# ------------------------------------------------------------------
RUN $PIP_INSTALL \
tensorflow-gpu
# ==================================================================
# theano
# ------------------------------------------------------------------
RUN DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
libblas-dev
RUN wget -qO- https://github.com/Theano/libgpuarray/archive/v0.7.6.tar.gz | tar xz -C ~ && \
cd ~/libgpuarray* && mkdir -p build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
.. && \
make -j"$(nproc)" install && \
cd ~/libgpuarray* && \
python setup.py build && \
python setup.py install && \
printf '[global]\nfloatX = float32\ndevice = cuda0\n\n[dnn]\ninclude_path = /usr/local/cuda/targets/x86_64-linux/include\n' > ~/.theanorc && \
$PIP_INSTALL \
https://github.com/Theano/Theano/archive/master.zip
# ==================================================================
# keras
# ------------------------------------------------------------------
RUN $PIP_INSTALL \
h5py \
keras
# ==================================================================
# opencv
# ------------------------------------------------------------------
RUN DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
libatlas-base-dev \
libgflags-dev \
libgoogle-glog-dev \
libhdf5-serial-dev \
libleveldb-dev \
liblmdb-dev \
libprotobuf-dev \
libsnappy-dev \
protobuf-compiler \
&& \
$GIT_CLONE --branch 3.4.3 https://github.com/opencv/opencv ~/opencv && \
mkdir -p ~/opencv/build && cd ~/opencv/build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_IPP=OFF \
-D WITH_CUDA=OFF \
-D WITH_OPENCL=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
.. && \
make -j"$(nproc)" install
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
RUN ldconfig
#RUN apt-get clean && \
# apt-get autoremove && \
# rm -rf /var/lib/apt/lists/* /tmp/* ~/*
EXPOSE 6006
## Connection ports for controlling the UI:
# VNC port:5901
# noVNC webport, connect via http://IP:6901/?password=vncpassword
ENV DISPLAY=:1 \
VNC_PORT=5901 \
NO_VNC_PORT=6901
EXPOSE $VNC_PORT $NO_VNC_PORT
### Envrionment config
ENV HOME=/headless \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/headless/install \
NO_VNC_HOME=/headless/noVNC \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_VIEW_ONLY=false
WORKDIR $HOME
### Add all install scripts for further steps
ADD ./src/common/install/ $INST_SCRIPTS/
ADD ./src/ubuntu/install/ $INST_SCRIPTS/
RUN find $INST_SCRIPTS -name '*.sh' -exec chmod a+x {} +
### Install some common tools
RUN $INST_SCRIPTS/tools.sh
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
### Install custom fonts
RUN $INST_SCRIPTS/install_custom_fonts.sh
### Install xvnc-server & noVNC - HTML5 based VNC viewer
RUN $INST_SCRIPTS/tigervnc.sh
RUN $INST_SCRIPTS/no_vnc.sh
### Install firefox and chrome browser
RUN $INST_SCRIPTS/firefox.sh
RUN $INST_SCRIPTS/chrome.sh
### Install xfce UI
RUN $INST_SCRIPTS/xfce_ui.sh
ADD ./src/common/xfce/ $HOME/
### configure startup
RUN $INST_SCRIPTS/libnss_wrapper.sh
ADD ./src/common/scripts $STARTUPDIR
RUN $INST_SCRIPTS/set_user_permission.sh $STARTUPDIR $HOME
# Change wallpaper
COPY xfce4-desktop.xml /headless/.config/xfce4/xfconf/xfce-perchannel-xml/
RUN apt-get update && apt-get install -y sudo
# Create a user called "adclab", give it sudo access and remove the requirement for a password:
RUN useradd --create-home --shell /bin/bash --no-log-init --groups sudo adclab
RUN sudo bash -c 'echo "adclab ALL=(ALL:ALL) NOPASSWD: ALL" | (EDITOR="tee -a" visudo)'
# While we are still root, install the necessary dependencies for UxAS:
RUN apt-get update -y && apt-get install -y --no-install-recommends \
ant \
autoconf \
build-essential \
cmake \
curl \
git \
libtool-bin \
pkg-config \
python3-pip \
python3-setuptools \
python3-dev \
vim \
wget \
software-properties-common \
dos2unix \
automake
#&& sudo apt remove -y libzmq3-dev libczmq4 libzmq5 \
#&& sudo rm -rf /var/lib/apt/lists/*
RUN sudo update-ca-certificates -f
RUN sudo pip3 install setuptools
RUN sudo pip3 install wheel
# Switch to the adclab user:
WORKDIR /home/adclab
# Install Jupyter:
#RUN sudo pip3 install jupyter
# Convert dos chars to unix chars on the startup script.
COPY ./console_startup.sh /home/adclab/console_startup.sh
RUN dos2unix /home/adclab/console_startup.sh
RUN chmod a+x /home/adclab/console_startup.sh
# Found that this is due to meson not being used correctly... because dependency is being used and not find_library, it is free to select a system installed lib. Also because versions are not specfied on the dependency it is free to select any installed version of libzmq and libczmq, which is also a bug.
# Let's clean up all the extra packages
RUN sudo apt -y autoremove
# Fix up some permissions issues. Must be a bug in the script above
# somewhere.. maybe an ordering issue.
RUN chmod a+rwx /headless
# Now start folding in all the deep learning crap
RUN pip3 install gym[atari]
COPY ./test_atari.py /home/adclab
ENTRYPOINT ["/home/adclab/console_startup.sh"]