Skip to content

Commit c7f4d35

Browse files
author
Shubham Shrivastava
committed
add Dockerfile
1 parent 074e368 commit c7f4d35

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

docker/Dockerfile

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
setuptools==59.5.0
99+
100+
# install mmdetection3d from source
101+
ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
102+
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
103+
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
104+
105+
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 \
106+
&& apt-get clean \
107+
&& rm -rf /var/lib/apt/lists/*
108+
RUN git clone https://github.com/open-mmlab/mmdetection3d.git && \
109+
cd mmdetection3d && \
110+
git checkout v0.17.1 && \
111+
python -m pip install -r requirements/build.txt && \
112+
python -m pip install --no-cache-dir -e .
113+
114+
# install timm
115+
RUN python -m pip install timm
116+
117+
# libraries path
118+
RUN ln -s /usr/local/cuda/lib64/libcusolver.so.11 /usr/local/cuda/lib64/libcusolver.so.10
119+
120+
USER root
121+
RUN ["/bin/bash"]

0 commit comments

Comments
 (0)