Skip to content

Commit ecb2161

Browse files
committed
Lablup Basekernel 20.08 for CPU instance
1 parent e8a6be1 commit ecb2161

File tree

1 file changed

+328
-0
lines changed

1 file changed

+328
-0
lines changed

commons/Dockerfile.base.20.08-py36

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

0 commit comments

Comments
 (0)