-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDOCKERFILE
226 lines (191 loc) · 7.15 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
222
223
224
225
226
# local 빌드시
FROM tensorflow/tensorflow:2.9.1-gpu-jupyter
FROM nvidia/cuda:11.2.1-cudnn8-devel-ubuntu18.04 AS nvidia
# CUDA
ENV CUDA_MAJOR_VERSION=11
ENV CUDA_MINOR_VERSION=2
ENV CUDA_VERSION=$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/opt/bin:${PATH}
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
ENV LD_LIBRARY_PATH_NO_STUBS="/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/opt/conda/lib"
ENV LD_LIBRARY_PATH="/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:/opt/conda/lib"
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV NVIDIA_REQUIRE_CUDA="cuda>=$CUDA_MAJOR_VERSION.$CUDA_MINOR_VERSION"
# 카카오 ubuntu archive mirror server 추가. 다운로드 속도 향상
RUN sed -i 's@archive.ubuntu.com@mirror.kakao.com@g' /etc/apt/sources.list && \
apt-get update && apt-get install alien -y
# openjdk java vm 설치
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
build-essential \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
g++ \
gcc \
openjdk-8-jdk \
python3-dev \
python3-pip \
curl \
bzip2 \
ca-certificates \
libglib2.0-0 \
libxext6 \
libsm6 \
libxrender1 \
libssl-dev \
libzmq3-dev \
vim \
git
RUN apt-get update
ARG CONDA_DIR=/opt/conda
# add to path
ENV PATH $CONDA_DIR/bin:$PATH
# Install miniconda
RUN echo "export PATH=$CONDA_DIR/bin:"'$PATH' > /etc/profile.d/conda.sh && \
curl -sL https://repo.anaconda.com/miniconda/Miniconda3-py37_4.12.0-Linux-x86_64.sh -o ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p $CONDA_DIR && \
rm ~/miniconda.sh
# Conda 가상환경 생성
RUN conda config --set always_yes yes --set changeps1 no && \
conda create -y -q -n py37 python=3.7
ENV PATH /opt/conda/envs/py37/bin:$PATH
ENV CONDA_DEFAULT_ENV py37
ENV CONDA_PREFIX /opt/conda/envs/py37
# 패키지 설치
RUN pip install setuptools && \
pip install mkl && \
pip install pymysql && \
pip install numpy && \
pip install scipy && \
pip install pandas==1.3.5 && \
pip install jupyter notebook && \
pip install jupyterlab && \
pip install jupyterthemes && \
pip install matplotlib && \
pip install seaborn && \
pip install hyperopt && \
pip install optuna && \
pip install missingno && \
pip install mlxtend && \
pip install catboost && \
pip install kaggle && \
pip install folium && \
pip install librosa && \
pip install nbconvert && \
pip install Pillow && \
pip install tqdm && \
pip install tensorflow==2.9.1 && \
pip install tensorflow-datasets && \
pip install gensim && \
pip install nltk && \
pip install wordcloud && \
pip install scikit-surprise && \
pip install scikit-learn && \
pip install implicit && \
pip install faiss-cpu && \
pip install annoy && \
pip install wandb && \
apt-get install -y graphviz && pip install graphviz && \
pip install cupy-cuda112
# Pytorch 설치
RUN pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 torchaudio==0.10.1 -f https://download.pytorch.org/whl/torch_stable.html
RUN pip install --upgrade cython && \
pip install --upgrade cysignals && \
pip install pyfasttext && \
pip install fasttext && \
pip install transformers
RUN pip install pystan==2.19.1.1 && \
pip install prophet && \
pip install torchsummary
RUN pip install "sentencepiece<0.1.90" wandb tensorboard albumentations pydicom opencv-python scikit-image pyarrow kornia \
catalyst captum
RUN pip install fastai
# RUN conda install -c rapidsai -c nvidia -c numba -c conda-forge cudf=22.06 python=3.7 cudatoolkit=11.2
# cmake 설치 (3.16)
RUN wget https://cmake.org/files/v3.16/cmake-3.16.2.tar.gz && \
tar -xvzf cmake-3.16.2.tar.gz && \
cd cmake-3.16.2 && \
./bootstrap && \
make && \
make install
ENV PATH=/usr/local/bin:${PATH}
# 나눔고딕 폰트 설치
# matplotlib에 Nanum 폰트 추가
RUN apt-get install fonts-nanum* && \
cp /usr/share/fonts/truetype/nanum/Nanum* /opt/conda/envs/py37/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf/ && \
fc-cache -fv && \
rm -rf ~/.cache/matplotlib/*
# konlpy, py-hanspell, soynlp 패키지 설치
RUN pip install konlpy
# 형태소 분석기 mecab 설치
RUN cd /tmp && \
wget "https://www.dropbox.com/s/9xls0tgtf3edgns/mecab-0.996-ko-0.9.2.tar.gz?dl=1" && \
tar zxfv mecab-0.996-ko-0.9.2.tar.gz?dl=1 && \
cd mecab-0.996-ko-0.9.2 && \
./configure && \
make && \
make check && \
make install && \
ldconfig
RUN cd /tmp && \
wget "https://www.dropbox.com/s/i8girnk5p80076c/mecab-ko-dic-2.1.1-20180720.tar.gz?dl=1" && \
apt install -y autoconf && \
tar zxfv mecab-ko-dic-2.1.1-20180720.tar.gz?dl=1 && \
cd mecab-ko-dic-2.1.1-20180720 && \
./autogen.sh && \
./configure && \
make && \
make install && \
ldconfig
# 형태소 분석기 mecab 파이썬 패키지 설치
RUN cd /tmp && \
git clone https://bitbucket.org/eunjeon/mecab-python-0.996.git && \
cd mecab-python-0.996 && \
python setup.py build && \
python setup.py install
# XGBoost (GPU 설치)
RUN git clone --recursive https://github.com/dmlc/xgboost && \
cd xgboost && \
mkdir build && \
cd build && \
cmake .. -DUSE_CUDA=ON && \
make -j4 && \
cd .. && \
cd python-package && \
python setup.py install --use-cuda --use-nccl
# Install OpenCL & libboost (required by LightGBM GPU version)
RUN apt-get install -y ocl-icd-libopencl1 clinfo libboost-all-dev && \
mkdir -p /etc/OpenCL/vendors && \
echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
# lightgbm (GPU 설치)
RUN pip uninstall -y lightgbm && \
cd /usr/local/src && mkdir lightgbm && cd lightgbm && \
git clone --recursive --branch stable --depth 1 https://github.com/microsoft/LightGBM && \
cd LightGBM && mkdir build && cd build && \
cmake -DUSE_GPU=1 -DOpenCL_LIBRARY=/usr/local/cuda/lib64/libOpenCL.so -DOpenCL_INCLUDE_DIR=/usr/local/cuda/include/ .. && \
make -j$(nproc) OPENCL_HEADERS=/usr/local/cuda-11.2/targets/x86_64-linux/include LIBOPENCL=/usr/local/cuda-11.2/targets/x86_64-linux/lib && \
cd /usr/local/src/lightgbm/LightGBM/python-package && python setup.py install --precompile
# Remove the CUDA stubs.
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH_NO_STUBS"
# locale 설정
# RUN apt-get update && apt-get install -y locales tzdata && \
# locale-gen ko_KR.UTF-8 && locale -a && \
# ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
RUN apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
conda clean -a -y
# LANG 환경변수 설정
ENV LANG ko_KR.UTF-8
# Jupyter Notebook config 파일 생성
# RUN jupyter notebook --generate-config
# config 파일 복사 (jupyter_notebook_config.py 파일 참고)
# COPY jupyter_notebook_config.py /root/.jupyter/jupyter_notebook_config.py
# 설치 완료 후 테스트용 ipynb
COPY test.ipynb /home/jupyter/test.ipynb
# 기본
EXPOSE 8888
# jupyter notebook 의 password를 지정하지 않으면 보안상 취약하므로 지정하는 것을 권장
# CMD jupyter notebook --allow-root