|
| 1 | +# ================================================================== |
| 2 | +# module list |
| 3 | +# ------------------------------------------------------------------ |
| 4 | +# python 3.6 (apt) |
| 5 | +# pytorch latest (pip) |
| 6 | +# ================================================================== |
| 7 | +# FROM nvidia/cuda:9.2-cudnn7-devel-ubuntu18.04 |
| 8 | +FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04 |
| 9 | +ENV LANG C.UTF-8 |
| 10 | + |
| 11 | +ENV APT_INSTALL="apt-get install -y --no-install-recommends" \ |
| 12 | + PIP_INSTALL="python -m pip --no-cache-dir install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple --default-timeout=100000" \ |
| 13 | + GIT_CLONE="git clone --depth 1" |
| 14 | + |
| 15 | +# added by user |
| 16 | +COPY ./sources.list.tuna.txt /etc/apt/ |
| 17 | +RUN bash -xc " \ |
| 18 | + echo 'change sources.list to tuna source' && \ |
| 19 | + pushd /etc/apt && \ |
| 20 | + mv sources.list sources.list.origin.txt && \ |
| 21 | + mv sources.list.tuna.txt sources.list && \ |
| 22 | + popd \ |
| 23 | +" |
| 24 | + |
| 25 | +RUN rm -rf /var/lib/apt/lists/* \ |
| 26 | + /etc/apt/sources.list.d/cuda.list \ |
| 27 | + /etc/apt/sources.list.d/nvidia-ml.list && \ |
| 28 | + |
| 29 | + apt-get update && \ |
| 30 | + |
| 31 | +# ================================================================== |
| 32 | +# tools |
| 33 | +# ------------------------------------------------------------------ |
| 34 | + |
| 35 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 36 | + build-essential \ |
| 37 | + apt-utils \ |
| 38 | + ca-certificates \ |
| 39 | + wget \ |
| 40 | + git \ |
| 41 | + vim \ |
| 42 | + libssl-dev \ |
| 43 | + curl \ |
| 44 | + unzip \ |
| 45 | + unrar \ |
| 46 | + && \ |
| 47 | + |
| 48 | + $GIT_CLONE https://github.com/Kitware/CMake ~/cmake && \ |
| 49 | + cd ~/cmake && \ |
| 50 | + ./bootstrap && \ |
| 51 | + make -j"$(nproc)" install && \ |
| 52 | + |
| 53 | +# ================================================================== |
| 54 | +# python |
| 55 | +# ------------------------------------------------------------------ |
| 56 | + |
| 57 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 58 | + software-properties-common \ |
| 59 | + && \ |
| 60 | + add-apt-repository ppa:deadsnakes/ppa && \ |
| 61 | + apt-get update && \ |
| 62 | + DEBIAN_FRONTEND=noninteractive $APT_INSTALL \ |
| 63 | + python3.6 \ |
| 64 | + python3.6-dev \ |
| 65 | + python3-distutils-extra \ |
| 66 | + && \ |
| 67 | + wget -O ~/get-pip.py \ |
| 68 | + https://bootstrap.pypa.io/get-pip.py && \ |
| 69 | + python3.6 ~/get-pip.py && \ |
| 70 | + ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \ |
| 71 | + ln -s /usr/bin/python3.6 /usr/local/bin/python && \ |
| 72 | + $PIP_INSTALL \ |
| 73 | + setuptools \ |
| 74 | + && \ |
| 75 | + $PIP_INSTALL \ |
| 76 | + # numpy \ |
| 77 | + # scipy \ |
| 78 | + # pandas \ |
| 79 | + cloudpickle \ |
| 80 | + # scikit-image>=0.14.2 \ |
| 81 | + # scikit-learn \ |
| 82 | + # matplotlib \ |
| 83 | + # Cython \ |
| 84 | + tqdm \ |
| 85 | + && \ |
| 86 | + |
| 87 | +# ================================================================== |
| 88 | +# pytorch |
| 89 | +# ------------------------------------------------------------------ |
| 90 | + |
| 91 | + $PIP_INSTALL \ |
| 92 | + future \ |
| 93 | + # numpy \ |
| 94 | + protobuf \ |
| 95 | + enum34 \ |
| 96 | + pyyaml \ |
| 97 | + typing \ |
| 98 | + && \ |
| 99 | + |
| 100 | +# $PIP_INSTALL \ |
| 101 | +# --pre torch torchvision -f \ |
| 102 | +# https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html \ |
| 103 | +# && \ |
| 104 | + |
| 105 | +# $PIP_INSTALL torch==1.5.1 torchvision==0.6.1 && \ |
| 106 | + |
| 107 | +# ================================================================== |
| 108 | +# config & cleanup |
| 109 | +# ------------------------------------------------------------------ |
| 110 | + |
| 111 | + ldconfig && \ |
| 112 | + apt-get clean && \ |
| 113 | + apt-get autoremove && \ |
| 114 | + rm -rf /var/lib/apt/lists/* /tmp/* ~/* |
| 115 | + |
| 116 | +# ================================================================== |
| 117 | +# additional apt pacakges |
| 118 | +# ------------------------------------------------------------------ |
| 119 | + |
| 120 | +# personal tmux config file |
| 121 | +COPY ./.tmux.conf /root/ |
| 122 | +RUN apt update && \ |
| 123 | + $APT_INSTALL tmux && \ |
| 124 | + # needed by opencv |
| 125 | + $APT_INSTALL libsm6 libxrender1 libxext6 && \ |
| 126 | + $APT_INSTALL htop && \ |
| 127 | + echo "tmux installed." |
| 128 | + |
| 129 | +# TODO: add cloning of https://github.com/tmux-plugins/tmux-resurrect @ /root/Utils |
| 130 | + |
| 131 | +# ================================================================== |
| 132 | +# video_analyst |
| 133 | +# ------------------------------------------------------------------ |
| 134 | +COPY ./requirements.txt /root/ |
| 135 | +RUN $PIP_INSTALL -r /root/requirements.txt && \ |
| 136 | + echo "ended." |
| 137 | + |
| 138 | +# TODO: only wget & install: https://github.com/MARMOTatZJU/video_analyst/blob/dev/requirements.txt |
0 commit comments