|
| 1 | +ARG CUDA_VERSION=11.3.1 |
| 2 | +ARG OS_VERSION=20.04 |
| 3 | +# pull a prebuilt image |
| 4 | +FROM nvidia/cuda:${CUDA_VERSION}-cudnn8-devel-ubuntu${OS_VERSION} |
| 5 | + |
| 6 | +# setup timezone |
| 7 | +ENV TZ=US/Pacific |
| 8 | +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone |
| 9 | + |
| 10 | +SHELL ["/bin/bash", "-c"] |
| 11 | + |
| 12 | +# Required to build Ubuntu 20.04 without user prompts with DLFW container |
| 13 | +ENV DEBIAN_FRONTEND=noninteractive |
| 14 | + |
| 15 | +# Install requried libraries |
| 16 | +RUN apt-get update && apt-get install -y software-properties-common |
| 17 | +RUN add-apt-repository ppa:ubuntu-toolchain-r/test |
| 18 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 19 | + libcurl4-openssl-dev \ |
| 20 | + wget \ |
| 21 | + zlib1g-dev \ |
| 22 | + git \ |
| 23 | + sudo \ |
| 24 | + ssh \ |
| 25 | + libssl-dev \ |
| 26 | + pbzip2 \ |
| 27 | + pv \ |
| 28 | + bzip2 \ |
| 29 | + unzip \ |
| 30 | + devscripts \ |
| 31 | + lintian \ |
| 32 | + fakeroot \ |
| 33 | + dh-make \ |
| 34 | + build-essential \ |
| 35 | + curl \ |
| 36 | + ca-certificates \ |
| 37 | + libx11-6 \ |
| 38 | + nano \ |
| 39 | + graphviz \ |
| 40 | + libgl1-mesa-glx \ |
| 41 | + openssh-server \ |
| 42 | + apt-transport-https |
| 43 | + |
| 44 | +# Install other dependencies |
| 45 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 46 | + libgtk2.0-0 \ |
| 47 | + libcanberra-gtk-module \ |
| 48 | + libsm6 libxext6 libxrender-dev \ |
| 49 | + libgtk2.0-dev pkg-config \ |
| 50 | + libopenmpi-dev \ |
| 51 | + && sudo rm -rf /var/lib/apt/lists/* |
| 52 | + |
| 53 | +# Install Miniconda |
| 54 | +RUN wget \ |
| 55 | + https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ |
| 56 | + && mkdir /root/.conda \ |
| 57 | + && bash Miniconda3-latest-Linux-x86_64.sh -b \ |
| 58 | + && rm -f Miniconda3-latest-Linux-x86_64.sh |
| 59 | + |
| 60 | +ENV CONDA_DEFAULT_ENV=${project} |
| 61 | +ENV CONDA_PREFIX=/root/miniconda3/envs/$CONDA_DEFAULT_ENV |
| 62 | +ENV PATH=/root/miniconda3/bin:$CONDA_PREFIX/bin:$PATH |
| 63 | + |
| 64 | +# install python 3.8 |
| 65 | +RUN conda install python=3.8 |
| 66 | +RUN alias python='/root/miniconda3/envs/bin/python3.8' |
| 67 | + |
| 68 | +# Set environment and working directory |
| 69 | +ENV CUDA_HOME=/usr/local/cuda |
| 70 | +ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64/:$LD_LIBRARY_PATH |
| 71 | +ENV PATH=$CUDA_HOME/bin:$PATH |
| 72 | +ENV CFLAGS="-I$CUDA_HOME/include $CFLAGS" |
| 73 | +ENV FORCE_CUDA="1" |
| 74 | +ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/miniconda3/envs/bin:$PATH |
| 75 | + |
| 76 | +# install pytorch |
| 77 | +RUN pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html |
| 78 | + |
| 79 | +# install opencv |
| 80 | +RUN python -m pip install opencv-python==4.5.5.62 |
| 81 | + |
| 82 | +# install gcc |
| 83 | +RUN conda install -c omgarcia gcc-6 |
| 84 | + |
| 85 | +# install torchpack |
| 86 | +RUN git clone https://github.com/zhijian-liu/torchpack.git |
| 87 | +RUN cd torchpack && python -m pip install -e . |
| 88 | + |
| 89 | +# install other dependencies |
| 90 | +RUN python -m pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html |
| 91 | +RUN python -m pip install pillow==8.4.0 \ |
| 92 | + tqdm \ |
| 93 | + mmdet==2.14.0 \ |
| 94 | + mmsegmentation==0.14.1 \ |
| 95 | + numba \ |
| 96 | + mpi4py \ |
| 97 | + nuscenes-devkit |
| 98 | + |
| 99 | +# install mmdetection3d from source |
| 100 | +ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX" |
| 101 | +ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all" |
| 102 | +ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" |
| 103 | + |
| 104 | +RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \ |
| 105 | + && apt-get clean \ |
| 106 | + && rm -rf /var/lib/apt/lists/* |
| 107 | +RUN git clone https://github.com/open-mmlab/mmdetection3d.git && \ |
| 108 | + cd mmdetection3d && \ |
| 109 | + git checkout v0.17.1 && \ |
| 110 | + python -m pip install -r requirements/build.txt && \ |
| 111 | + python -m pip install --no-cache-dir -e . |
| 112 | + |
| 113 | +# install timm |
| 114 | +RUN python -m pip install timm |
| 115 | + |
| 116 | +# libraries path |
| 117 | +RUN ln -s /usr/local/cuda/lib64/libcusolver.so.11 /usr/local/cuda/lib64/libcusolver.so.10 |
| 118 | + |
| 119 | +USER root |
| 120 | +RUN ["/bin/bash"] |
0 commit comments