-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathDockerfile
221 lines (187 loc) · 6.6 KB
/
Dockerfile
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
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04
ENV DEBIAN_FRONTEND noninteractive
# Core Linux Deps
RUN apt update
RUN apt install build-essential
RUN gcc --version
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --fix-missing --no-install-recommends apt-utils \
build-essential \
curl \
binutils \
gdb \
git \
freeglut3 \
freeglut3-dev \
libxi-dev \
libxmu-dev \
gfortran \
pkg-config \
python-setuptools \
libboost-python-dev \
libboost-thread-dev \
pbzip2 \
rsync \
software-properties-common \
libboost-all-dev \
libopenblas-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libgraphicsmagick1-dev \
libavformat-dev \
libhdf5-dev \
libpq-dev \
libgraphicsmagick1-dev \
libavcodec-dev \
libgtk2.0-dev \
liblapack-dev \
liblapacke-dev \
libswscale-dev \
libcanberra-gtk-module \
libboost-dev \
libboost-all-dev \
libeigen3-dev \
wget \
vim \
unzip \
zip \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && rm -rf /tmp/* /var/tmp/*
ENV DEBIAN_FRONTEND noninteractive
# Install cmake version that supports anaconda python path
RUN wget -O cmake.tar.gz https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.tar.gz
RUN tar -xvf cmake.tar.gz
WORKDIR /cmake-3.15.4-Linux-x86_64
RUN cp -r bin /usr/
RUN cp -r share /usr/
RUN cp -r doc /usr/share/
RUN cp -r man /usr/share/
WORKDIR /
RUN rm -rf cmake-3.15.4-Linux-x86_64
RUN rm -rf cmake.tar.gz
# Install TensorRT (TPU Access)
#RUN apt-get update && apt-get install -y --no-install-recommends \
# libnvinfer7=7.1.3-1+cuda11.0 \
# libnvinfer-dev=7.1.3-1+cuda11.0 \
# libnvinfer-plugin7=7.1.3-1+cuda11.0 \
# libnvinfer-plugin-dev=7.1.3-1+cuda11.0
#RUN apt-get update && \
# apt-get install -y nvinfer-runtime-trt-repo-ubuntu1804-5.0.2-ga-cuda10.0 && \
# apt-get update && \
# apt-get install -y libnvinfer5=5.0.2-1+cuda10.0
RUN file="$(ls -1 /usr/local/)" && echo $file
# Fix conda errors per Anaconda team until they can fix
RUN mkdir ~/.conda
# Install Anaconda
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
/bin/bash Miniconda3-latest-Linux-x86_64.sh -f -b -p /opt/conda && \
rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH /opt/conda/bin:$PATH
# For CUDA profiling, TensorFlow requires CUPTI.
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
ARG PYTHON=python3
ARG PIP=pip3
# See http://bugs.python.org/issue19846
ENV LANG C.UTF-8
RUN apt-get update && apt-get install -y \
${PYTHON} \
${PYTHON}-pip
RUN ${PIP} --no-cache-dir install --upgrade \
pip \
setuptools \
hdf5storage \
h5py \
py3nvml \
scikit-image \
scikit-learn \
matplotlib \
pyinstrument
# Add auto-complete to Juypter
RUN pip install jupyter-tabnine
RUN pip install cupy-cuda111
RUN pip install mlflow
RUN pip install seldon-core
RUN pip install albumentations
RUN pip install networkx
RUN pip install jupyter-tabnine
RUN pip install shap
RUN pip install tensor-sensor
#RUN pip install fastapi
#RUN pip install torch-scatter==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html
#RUN pip install torch-sparse==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html
#RUN pip install torch-cluster==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html
#RUN pip install torch-spline-conv==latest+cu101 -f https://pytorch-geometric.com/whl/torch-1.6.0.html
#RUN pip install torch-geometric
RUN conda update -n base -c defaults conda
RUN conda install -c anaconda jupyter
RUN conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
#RUN conda install pyg -c pyg
RUN conda update conda
RUN conda install numba
#RUN conda install -c anaconda cupy
RUN conda install -c anaconda ipykernel
RUN conda install -c anaconda seaborn
RUN conda install -c anaconda ipython
RUN conda install tensorflow
RUN conda install -c conda-forge tensorboard
RUN conda install -c conda-forge protobuf
RUN conda install captum -c pytorch
WORKDIR /
RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip
RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip
RUN unzip opencv.zip
RUN unzip opencv_contrib.zip
RUN mv opencv-master opencv
RUN mv opencv_contrib-master opencv_contrib
RUN mkdir /opencv/build
WORKDIR /opencv/build
RUN cmake -DBUILD_TIFF=ON \
-DBUILD_opencv_java=OFF \
-DWITH_CUDA=ON \
-DCUDA_ARCH_BIN=7.5 \
-DENABLE_FAST_MATH=1 \
-DCUDA_FAST_MATH=1 \
-DWITH_CUBLAS=1 \
-DENABLE_AVX=ON \
-DWITH_OPENGL=ON \
-DWITH_OPENCL=OFF \
-DWITH_IPP=ON \
-DWITH_TBB=ON \
-DWITH_EIGEN=ON \
-DWITH_V4L=ON \
# -DBUILD_TESTS=OFF \
# -DBUILD_PERF_TESTS=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON_INCLUDE_DIR2=$(python3 -c "from os.path import dirname; from distutils.sysconfig import get_config_h_filename; print(dirname(get_config_h_filename()))") \
-D PYTHON_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var;from os.path import dirname,join ; print(join(dirname(get_config_var('LIBPC')),get_config_var('LDLIBRARY')))") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-DOPENCV_ENABLE_NONFREE=ON \
-DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-DBUILD_EXAMPLES=ON \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.8 \
-DWITH_QT=ON ..
RUN make -j4 \
&& make install \
&& rm /opencv.zip \
&& rm /opencv_contrib.zip \
&& rm -rf /opencv \
&& rm -rf /opencv_contrib
WORKDIR /
# dlib
RUN cd ~ && \
mkdir -p dlib && \
git clone -b master --single-branch https://github.com/davisking/dlib.git dlib/ && \
cd dlib/ && \
python3 setup.py install
WORKDIR /app
EXPOSE 8888 6006
# Better container security versus running as root
RUN useradd -ms /bin/bash container_user
CMD ["bash", "-c", "source /etc/bash.bashrc && jupyter notebook --notebook-dir=/app --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.custom_display_url='http://localhost:8888'"]