|
| 1 | +# modify from https://github.com/NVIDIA/TensorRT/blob/master/docker/ubuntu.Dockerfile |
| 2 | +ARG CUDA_VERSION=10.2 |
| 3 | +ARG CUDNN_VERSION=8 |
| 4 | +ARG OS_VERSION=16.04 |
| 5 | +ARG NVCR_SUFFIX= |
| 6 | +FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VERSION}-devel-ubuntu${OS_VERSION}${NVCR_SUFFIX} |
| 7 | + |
| 8 | +LABEL maintainer="Simpledet" |
| 9 | + |
| 10 | +WORKDIR workspace |
| 11 | + |
| 12 | +# basic |
| 13 | +RUN apt-get update && \ |
| 14 | + apt-get install -y --no-install-recommends && \ |
| 15 | + apt-get install -y build-essential python-dev python3-dev && \ |
| 16 | + apt-get install -y git wget sudo curl openssh-server openssh-client bash-completion command-not-found \ |
| 17 | + vim htop tmux zsh rsync bzip2 zip unzip patch time make cmake locales locales-all libgtk2.0-dev libgl1-mesa-glx python3-tk \ |
| 18 | + ninja-build libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev \ |
| 19 | + xz-utils tk-dev libffi-dev liblzma-dev python-openssl libopenblas-dev && \ |
| 20 | + rm -rf /var/lib/apt/lists/* |
| 21 | +RUN ln -sfv /usr/bin/python3 /usr/bin/python |
| 22 | + |
| 23 | +# zsh and fzf |
| 24 | +RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true && \ |
| 25 | + git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \ |
| 26 | + sed -i 's/robbyrussell/fishy/' ~/.zshrc && \ |
| 27 | + sed -i 's/(git)/(git zsh-autosuggestions)/' ~/.zshrc && \ |
| 28 | + sed -i 's/# DISABLE_AUTO_UPDATE/DISABLE_AUTO_UPDATE/' ~/.zshrc && \ |
| 29 | + git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install --all |
| 30 | + |
| 31 | +# use pyenv to manage python version |
| 32 | +RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \ |
| 33 | + echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc && \ |
| 34 | + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc && \ |
| 35 | + echo 'export PYTHON_CONFIGURE_OPTS="--enable-shared"' >> ~/.zshrc && \ |
| 36 | + echo 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc |
| 37 | + |
| 38 | +RUN /usr/bin/zsh -c "source ~/.zshrc && \ |
| 39 | + pyenv install 3.6.8 && \ |
| 40 | + pyenv global 3.6.8 && \ |
| 41 | + eval zsh && \ |
| 42 | + pip install -U pipenv setuptools && \ |
| 43 | + pip install ipython numpy scipy scikit-learn tqdm graphviz easydict matplotlib pyarrow pyzmq pillow cython requests pytz opencv-python tensorboard && \ |
| 44 | + rm -rf ~/.cache" |
| 45 | + |
| 46 | +# build mxnet |
| 47 | +RUN /usr/bin/zsh -c "source ~/.zshrc && \ |
| 48 | + git clone --recursive https://github.com/apache/incubator-mxnet /tmp/mxnet -b 1.6.0 && \ |
| 49 | + git clone https://github.com/Tusimple/simpledet /tmp/simpledet && \ |
| 50 | + git clone https://github.com/RogerChern/cocoapi /tmp/cocoapi && \ |
| 51 | + cp -r /tmp/simpledet/operator_cxx/* /tmp/mxnet/src/operator && \ |
| 52 | + mkdir -p /tmp/mxnet/src/coco_api && \ |
| 53 | + cp -r /tmp/cocoapi/common /tmp/mxnet/src/coco_api && \ |
| 54 | + cd /tmp/mxnet && \ |
| 55 | + echo 'USE_SIGNAL_HANDLER = 1' >> ./config.mk && \ |
| 56 | + echo 'USE_OPENCV = 0' >> ./config.mk && \ |
| 57 | + echo 'USE_MKLDNN = 0' >> ./config.mk && \ |
| 58 | + echo 'USE_BLAS = openblas' >> ./config.mk && \ |
| 59 | + echo 'USE_CUDA = 1' >> ./config.mk && \ |
| 60 | + echo 'USE_CUDA_PATH = /usr/local/cuda' >> ./config.mk && \ |
| 61 | + echo 'USE_CUDNN = 1' >> ./config.mk && \ |
| 62 | + echo 'USE_NCCL = 1' >> ./config.mk && \ |
| 63 | + echo 'USE_DIST_KVSTORE = 1' >> ./config.mk && \ |
| 64 | + echo 'CUDA_ARCH = -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86' >> ./config.mk && \ |
| 65 | + rm /tmp/mxnet/src/operator/nn/group_norm* && \ |
| 66 | + make -j$((`nproc`-1)) && \ |
| 67 | + cd python && \ |
| 68 | + python3 setup.py install && \ |
| 69 | + rm -rf /tmp/mxnet /tmp/simpledet /tmp/cocoapi" |
| 70 | + |
| 71 | +# install pycocotools and mxnext |
| 72 | +RUN /usr/bin/zsh -c "source ~/.zshrc && \ |
| 73 | + pip install 'git+https://github.com/RogerChern/cocoapi.git#subdirectory=PythonAPI' && \ |
| 74 | + pip install 'git+https://github.com/RogerChern/mxnext#egg=mxnext'" |
| 75 | + |
| 76 | +# ssh |
| 77 | +RUN chsh -s /usr/bin/zsh root && \ |
| 78 | + mkdir /var/run/sshd && \ |
| 79 | + echo 'root:simpledet' | chpasswd && \ |
| 80 | + sed -i '/PermitRootLogin/s/prohibit-password/yes/' /etc/ssh/sshd_config |
| 81 | +EXPOSE 22 |
| 82 | + |
| 83 | +# env |
| 84 | +RUN echo "export PATH=/usr/local/cuda/bin:\$PATH" >> ~/.zshrc && \ |
| 85 | + echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH" >> ~/.zsrhc |
| 86 | + |
| 87 | +CMD ["/usr/sbin/sshd", "-D"] |
| 88 | + |
0 commit comments