Skip to content

Commit 301590c

Browse files
committed
Base Kernel 20.09
1 parent 9ada165 commit 301590c

File tree

2 files changed

+369
-0
lines changed

2 files changed

+369
-0
lines changed

commons/Dockerfile.base

Lines changed: 369 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,369 @@
1+
FROM ubuntu:18.04
2+
3+
ENV NUMPY_VERSION 1.18.5
4+
ENV SCIPY_VERSION 1.5.2
5+
6+
# Python 2.7 or 3.6 is supported by Ubuntu Bionic out of the box
7+
ARG python=3.6
8+
ENV PYTHON_VERSION=${python}
9+
10+
ENV DEBIAN_FRONTEND=noninteractive \
11+
MPLBACKEND=Svg \
12+
PYTHONUNBUFFERED=1 \
13+
LD_LIBRARY_PATH="/usr/include/x86_64-linux-gnu:/opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/lib/intel64:/opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/include:/usr/local/lib:$LD_LIBRARY_PATH" \
14+
PATH="/usr/local/sbin:/usr/bin/cmake/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/src/lightgbm/LightGBM:/usr/local/bin/mecab" \
15+
LIBRARY_PATH="/opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/lib/intel64" \
16+
mecab_dicdir=/usr/local/lib/mecab/dic/mecab-ko-dic \
17+
LANG=C.UTF-8
18+
19+
# Set default shell to /bin/bash
20+
SHELL ["/bin/bash", "-cu"]
21+
22+
WORKDIR /tmp
23+
RUN apt-get update -y && \
24+
apt-get upgrade -y && \
25+
apt-get install -y --no-install-recommends \
26+
build-essential \
27+
gcc g++ make \
28+
automake \
29+
gfortran \
30+
wget zip unzip \
31+
software-properties-common
32+
33+
RUN apt update -y && \
34+
add-apt-repository -y "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
35+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
36+
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
37+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB && \
38+
wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list && \
39+
apt-get update -y && \
40+
apt-get install -y --no-install-recommends \
41+
ca-certificates \
42+
dkms \
43+
git \
44+
curl \
45+
vim \
46+
yasm \
47+
openssh-client openssh-server \
48+
libssl-dev \
49+
libmpdec2 \
50+
pdsh curl net-tools \
51+
iputils-ping \
52+
libcurl3-dev \
53+
libfreetype6-dev \
54+
libhdf5-serial-dev \
55+
libzmq3-dev \
56+
libjpeg-dev \
57+
libpng-dev \
58+
libsm6 \
59+
libxext6 \
60+
libxrender-dev \
61+
libcairo2-dev libgirepository1.0-dev pkg-config gir1.2-gtk-3.0 \
62+
libgeos-dev libgeos++-dev \
63+
openjdk-8-jdk \
64+
pkg-config \
65+
zlib1g-dev \
66+
mime-support \
67+
proj-bin libproj-dev libgeos-dev libgeos++-dev graphviz \
68+
python${PYTHON_VERSION} \
69+
python${PYTHON_VERSION}-dev \
70+
intel-mkl-2020.3-111 intel-ipp-2020.2-108 intel-tbb-2020.3-108 intel-daal-2020.2-108 intel-mpi-2019.8-108 \
71+
libxml2-dev \
72+
libxslt1-dev \
73+
libasound2-dev \
74+
libnuma-dev \
75+
libjasper-dev \
76+
libtiff-dev \
77+
libavcodec-dev \
78+
libavformat-dev \
79+
libswscale-dev \
80+
libxine2-dev \
81+
libv4l-dev \
82+
libboost-dev \
83+
libboost-system-dev \
84+
libboost-filesystem-dev \
85+
libopenblas-dev liblapack-dev \
86+
xvfb \
87+
fonts-nanum \
88+
fonts-nanum-coding \
89+
fonts-nanum-extra \
90+
&& \
91+
rm -fr /var/lib/apt/lists/* && \
92+
echo "/opt/intel/daal/lib/intel64" >> /etc/ls.so.conf && \
93+
echo "/opt/intel/ipp/lib/intel64" >> /etc/ls.so.conf && \
94+
echo "/opt/intel/lib/intel64" >> /etc/ls.so.conf && \
95+
echo "/opt/intel/mkl/lib/intel64" >> /etc/ls.so.conf && \
96+
apt-get clean && \
97+
rm -rf /var/lib/apt/lists/* && \
98+
ldconfig
99+
100+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
101+
apt-get update -y && \
102+
apt-get install -y --no-install-recommends nodejs && \
103+
apt-get clean && \
104+
rm -rf /var/lib/apt/lists/*
105+
106+
# OFED
107+
ENV STAGE_DIR=/tmp
108+
RUN mkdir -p ${STAGE_DIR}
109+
ENV MLNX_OFED_VERSION=4.6-1.0.1.1
110+
RUN cd ${STAGE_DIR} && \
111+
wget -q -O - http://www.mellanox.com/downloads/ofed/MLNX_OFED-${MLNX_OFED_VERSION}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64.tgz | tar xzf -
112+
RUN cd ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64 && \
113+
./mlnxofedinstall --user-space-only --without-fw-update --all -q && \
114+
cd ${STAGE_DIR} && \
115+
rm -rf ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu18.04-x86_64*
116+
117+
RUN if [[ "${PYTHON_VERSION}" == "3.6" ]]; then \
118+
apt-get install -y python${PYTHON_VERSION}-distutils python-apt ; \
119+
fi
120+
121+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
122+
123+
WORKDIR /tmp
124+
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
125+
python3 -m pip install --no-cache-dir -U setuptools pip
126+
127+
RUN python3 -m pip install --no-cache-dir --upgrade -Iv \
128+
Cython==0.29.21 \
129+
tornado==6.0.4 \
130+
pystan==2.19.1.1 \
131+
pycairo==1.19.0 \
132+
python-language-server[all] \
133+
matplotlib==3.1.1
134+
135+
WORKDIR /tmp
136+
RUN git clone -q --branch=master git://github.com/xianyi/OpenBLAS.git && \
137+
cd OpenBLAS && \
138+
make DYNAMIC_ARCH=1 NO_AFFINITY=1 NUM_THREADS=48 FC=gfortran NO_CBLAS=1 NO_LAPACK=1 NO_LAPACKE=1 && \
139+
make install
140+
141+
RUN git clone --recursive https://github.com/bodono/scs-python.git && \
142+
cd /tmp/scs-python && \
143+
python setup.py install --scs
144+
145+
RUN cd /tmp && \
146+
git clone --branch=v${NUMPY_VERSION} --depth=1 https://github.com/numpy/numpy.git numpy && \
147+
cd numpy && \
148+
git checkout -b v${NUMPY_VERSION} && \
149+
cp site.cfg.example site.cfg && \
150+
echo "[mkl]" >> site.cfg && \
151+
echo "include_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/include/" >> site.cfg && \
152+
echo "library_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/lib/intel64" >> site.cfg && \
153+
echo "mkl_libs = mkl_rt" >> site.cfg && \
154+
echo "lapack_libs =" >> site.cfg && \
155+
python3 setup.py bdist_wheel -d /tmp
156+
157+
# Install scipy
158+
RUN cd /tmp && \
159+
git clone --branch=v${SCIPY_VERSION} --depth=1 https://github.com/scipy/scipy.git scipy && \
160+
cd scipy && \
161+
git checkout -b v${SCIPY_VERSION} && \
162+
cp site.cfg.example site.cfg && \
163+
echo "[mkl]" >> site.cfg && \
164+
echo "include_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/include/" >> site.cfg && \
165+
echo "library_dirs = /opt/intel/compilers_and_libraries_2020.3.279/linux/mkl/lib/intel64" >> site.cfg && \
166+
echo "mkl_libs = mkl_rt" >> site.cfg && \
167+
echo "lapack_libs =" >> site.cfg && \
168+
python3 -m pip install -U --no-cache-dir /tmp/numpy-{NUMPY_VERSION}-cp36-cp36m-linux_x86_64.whl && \
169+
python3 setup.py install
170+
171+
RUN python3 -m pip install pip --no-cache-dir \
172+
Cartopy==0.18.0 \
173+
notebook==6.0.3
174+
175+
WORKDIR /tmp
176+
COPY ./requirements.txt /tmp
177+
RUN python3 -m pip install --no-cache-dir --upgrade -r requirements.txt && \
178+
python3 -m pip install --no-cache-dir tensorflow_model_analysis && \
179+
python3 -m pip uninstall -y \
180+
tensorboard tensorboard-plugin-wit tensorflow \
181+
tensorflow-estimator tensorflow-addons tensorflow-datasets \
182+
tensorflow-gan tensorflow-hub tensorflow-metadata \
183+
tensorflow-probability tensorflow-text \
184+
tensorflow-model-analysis tensorflow-serving-api \
185+
torch && \
186+
rm -f /tmp/requirements.txt
187+
188+
# install NLP packages *mecab-ko & khai*
189+
WORKDIR /tmp
190+
RUN curl -LO https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz && \
191+
tar zxfv mecab-0.996-ko-0.9.2.tar.gz && \
192+
cd mecab-0.996-ko-0.9.2 && \
193+
./configure && \
194+
make -j$(nproc) && \
195+
make check && \
196+
make install
197+
198+
# Install mecab-ko-dic"
199+
WORKDIR /tmp
200+
RUN curl -LO https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.1.1-20180720.tar.gz && \
201+
tar -zxvf mecab-ko-dic-2.1.1-20180720.tar.gz && \
202+
cd mecab-ko-dic-2.1.1-20180720 && \
203+
./autogen.sh && \
204+
./configure && \
205+
make -j$(nproc) && \
206+
sh -c 'echo "dicdir=/usr/local/lib/mecab/dic/mecab-ko-dic" > /usr/local/etc/mecabrc' && \
207+
make install && \
208+
cd /tmp && \
209+
git clone https://bitbucket.org/eunjeon/mecab-python-0.996.git && \
210+
python3 -m pip install /tmp/mecab-python-0.996
211+
212+
# OpenCV
213+
RUN ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h && \
214+
apt-get install -y \
215+
libgstreamer1.0-dev \
216+
libgstreamer-plugins-base1.0-dev \
217+
libgtk-3-dev \
218+
libtbb-dev \
219+
libatlas-base-dev \
220+
libdc1394-22-dev \
221+
libxvidcore-dev \
222+
libfaac-dev \
223+
libmp3lame-dev \
224+
libtheora-dev \
225+
libvorbis-dev \
226+
libxvidcore-dev \
227+
libopencore-amrnb-dev libopencore-amrwb-dev \
228+
libavresample-dev \
229+
x264 \
230+
libx264-dev \
231+
v4l-utils \
232+
libprotobuf-dev protobuf-compiler \
233+
libgoogle-glog-dev libgflags-dev \
234+
libgphoto2-dev \
235+
libeigen3-dev \
236+
libhdf5-dev \
237+
&& \
238+
apt-get clean && \
239+
rm -rf /var/lib/apt/lists/*
240+
241+
RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.1/cmake-3.18.1-Linux-x86_64.sh \
242+
-q -O /tmp/cmake-install.sh && \
243+
chmod u+x /tmp/cmake-install.sh && \
244+
mkdir /usr/bin/cmake && \
245+
/tmp/cmake-install.sh --skip-license --prefix=/usr/bin/cmake && \
246+
rm /tmp/cmake-install.sh
247+
248+
WORKDIR /tmp
249+
ENV OPENCV_VERSION="4.4.0"
250+
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
251+
wget -O opencv-contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
252+
unzip ${OPENCV_VERSION}.zip && \
253+
unzip opencv-contrib.zip && \
254+
mkdir opencv-${OPENCV_VERSION}/cmake_binary && \
255+
cd opencv-${OPENCV_VERSION}/cmake_binary && \
256+
cmake \
257+
-DCMAKE_BUILD_TYPE=RELEASE \
258+
-D BUILD_TIFF=ON \
259+
-D BUILD_opencv_java=OFF \
260+
-D ENABLE_FAST_MATH=1 \
261+
-D WITH_IPP=ON \
262+
-D WITH_TBB=ON \
263+
-D WITH_EIGEN=ON \
264+
-D WITH_V4L=ON \
265+
-D BUILD_TESTS=OFF \
266+
-D BUILD_PERF_TESTS=OFF \
267+
-D OPENCV_EXTRA_MODULES_PATH="../../opencv_contrib-4.4.0/modules" \
268+
-D CMAKE_BUILD_TYPE=RELEASE \
269+
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
270+
-D PYTHON_EXECUTABLE=$(which python3) \
271+
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
272+
-D PYTHON_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
273+
.. 2>&1 | tee cmake_messages.txt && \
274+
make -j$(nproc) && \
275+
make install && \
276+
cd /tmp && \
277+
python3 -m pip install --no-cache-dir opencv-python && \
278+
rm -fr opencv*
279+
280+
# XGBoost
281+
RUN git clone --recursive https://github.com/dmlc/xgboost && \
282+
cd xgboost && \
283+
mkdir build && \
284+
cd build && \
285+
cmake .. && \
286+
make -j$(nproc) && \
287+
cd ../python-package && \
288+
python3 setup.py install
289+
290+
# LightGBM
291+
RUN cd /usr/local/src && mkdir lightgbm && cd lightgbm && \
292+
git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \
293+
cd LightGBM && mkdir build && cd build && \
294+
cmake .. && \
295+
make -j$(nproc) && \
296+
cd /usr/local/src/lightgbm/LightGBM/python-package && \
297+
python3 setup.py install --precompile
298+
299+
# Install Open MPI
300+
RUN mkdir /tmp/openmpi && \
301+
cd /tmp/openmpi && \
302+
wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.4.tar.gz && \
303+
tar zxf openmpi-4.0.4.tar.gz && \
304+
cd openmpi-4.0.4 && \
305+
./configure --enable-orterun-prefix-by-default && \
306+
make -j $(nproc) all && \
307+
make install && \
308+
ldconfig && \
309+
rm -rf /tmp/openmpi*
310+
311+
# Install OpenSSH for MPI to communicate between containers
312+
RUN apt-get install -y --no-install-recommends openssh-client openssh-server && \
313+
mkdir -p /var/run/sshd
314+
315+
# Allow OpenSSH to talk to containers without asking for confirmation
316+
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
317+
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
318+
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
319+
320+
# Create a wrapper for OpenMPI to allow running as root by default
321+
RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \
322+
echo '#!/bin/bash' > /usr/local/bin/mpirun && \
323+
echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \
324+
chmod a+x /usr/local/bin/mpirun
325+
326+
# Configure OpenMPI to run good defaults:
327+
RUN echo "btl_tcp_if_exclude = lo,docker0" >> /usr/local/etc/openmpi-mca-params.conf
328+
329+
# Install OpenSSH for MPI to communicate between containers
330+
RUN mkdir -p /var/run/sshd
331+
332+
# Allow OpenSSH to talk to containers without asking for confirmation
333+
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
334+
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
335+
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
336+
337+
# install git-lfs
338+
WORKDIR /tmp
339+
RUN curl -sLO https://github.com/git-lfs/git-lfs/releases/download/v2.11.0/git-lfs-linux-amd64-v2.11.0.tar.gz && \
340+
tar -zxf git-lfs-linux-amd64-v2.11.0.tar.gz && \
341+
bash install.sh
342+
343+
COPY ./service-defs /etc/backend.ai/service-defs
344+
RUN curl -fL https://github.com/cdr/code-server/releases/download/v3.4.1/code-server-3.4.1-linux-amd64.tar.gz \
345+
| tar -C /usr/local/lib -xz && \
346+
mv /usr/local/lib/code-server-3.4.1-linux-amd64 /usr/local/lib/code-server-3.4.1 && \
347+
ln -s /usr/local/lib/code-server-3.4.1/bin/code-server /usr/local/bin/code-server
348+
349+
RUN jupyter nbextensions_configurator enable && \
350+
jupyter contrib nbextension install && \
351+
jupyter nbextension enable --py --sys-prefix widgetsnbextension && \
352+
jupyter serverextension enable --py jupyterlab --sys-prefix && \
353+
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager && \
354+
jupyter labextension install --no-build @krassowski/jupyterlab-lsp && \
355+
jupyter serverextension enable --py jupyter_lsp && \
356+
jupyter labextension install --no-build @jupyterlab/toc && \
357+
jupyter nbextension enable execute_time/ExecuteTime && \
358+
jupyter nbextension enable toc2/main && \
359+
jupyter labextension install @pyviz/jupyterlab_pyviz && \
360+
jupyter labextension install @bokeh/jupyter_bokeh && \
361+
jupyter labextension install --no-build jupyterlab-nvdashboard && \
362+
jupyter lab build
363+
364+
RUN apt autoclean && \
365+
rm -rf /var/lib/apt/lists/* && \
366+
rm -rf /root/.cache && \
367+
rm -rf /tmp
368+
369+
WORKDIR /home/work

0 commit comments

Comments
 (0)