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
+
43
+ # Install other dependencies
44
+ RUN apt-get update && apt-get install -y --no-install-recommends \
45
+ libgtk2.0-0 \
46
+ libcanberra-gtk-module \
47
+ libsm6 libxext6 libxrender-dev \
48
+ libgtk2.0-dev pkg-config \
49
+ libopenmpi-dev \
50
+ && sudo rm -rf /var/lib/apt/lists/*
51
+
52
+ # Install Miniconda
53
+ RUN wget \
54
+ https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
55
+ && mkdir /root/.conda \
56
+ && bash Miniconda3-latest-Linux-x86_64.sh -b \
57
+ && rm -f Miniconda3-latest-Linux-x86_64.sh
58
+
59
+ ENV CONDA_DEFAULT_ENV=${project}
60
+ ENV CONDA_PREFIX=/root/miniconda3/envs/$CONDA_DEFAULT_ENV
61
+ ENV PATH=/root/miniconda3/bin:$CONDA_PREFIX/bin:$PATH
62
+
63
+ # install python 3.8
64
+ RUN conda install python=3.8
65
+ RUN alias python='/root/miniconda3/envs/bin/python3.8'
66
+
67
+ # Set environment and working directory
68
+ ENV CUDA_HOME=/usr/local/cuda
69
+ ENV LD_LIBRARY_PATH=$CUDA_HOME/lib64:$CUDA_HOME/extras/CUPTI/lib64/:$LD_LIBRARY_PATH
70
+ ENV PATH=$CUDA_HOME/bin:$PATH
71
+ ENV CFLAGS="-I$CUDA_HOME/include $CFLAGS"
72
+ ENV FORCE_CUDA="1"
73
+ ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/miniconda3/envs/bin:$PATH
74
+
75
+ # install pytorch
76
+ 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
77
+
78
+ # install opencv
79
+ RUN python -m pip install opencv-python==4.5.5.62
80
+
81
+ # install gcc
82
+ RUN conda install -c omgarcia gcc-6
83
+
84
+ # install torchpack
85
+ RUN git clone https://github.com/zhijian-liu/torchpack.git
86
+ RUN cd torchpack && python -m pip install -e .
87
+
88
+ # install other dependencies
89
+ RUN python -m pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html
90
+ RUN python -m pip install pillow==8.4.0 \
91
+ tqdm \
92
+ mmdet==2.14.0 \
93
+ mmsegmentation==0.14.1 \
94
+ numba \
95
+ mpi4py \
96
+ nuscenes-devkit
97
+
98
+ # install mmdetection3d from source
99
+ ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
100
+ ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
101
+ ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
102
+
103
+ RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
104
+ && apt-get clean \
105
+ && rm -rf /var/lib/apt/lists/*
106
+ RUN git clone https://github.com/open-mmlab/mmdetection3d.git && \
107
+ cd mmdetection3d && \
108
+ git checkout v0.17.1 && \
109
+ python -m pip install -r requirements/build.txt && \
110
+ python -m pip install --no-cache-dir -e .
111
+
112
+ # install timm
113
+ RUN python -m pip install timm
114
+
115
+ # libraries path
116
+ RUN ln -s /usr/local/cuda/lib64/libcusolver.so.11 /usr/local/cuda/lib64/libcusolver.so.10
117
+
118
+ USER root
119
+ RUN ["/bin/bash" ]
0 commit comments