-
Notifications
You must be signed in to change notification settings - Fork 38
/
Dockerfile
273 lines (234 loc) · 7.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# Dockerfile based on the https://github.com/dusty-nv/jetson-containers
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r35.1.0
FROM ${BASE_IMAGE}
#
# setup environment
#
ENV DEBIAN_FRONTEND=noninteractive
ENV CUDA_HOME="/usr/local/cuda"
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
gnupg2 \
apt-utils \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#
# configure nvidia apt repo
#
COPY viplanner/bin/packages/nvidia-l4t-apt-source.list /tmp/apt/nvidia-l4t-apt-source.list
COPY viplanner/bin/packages/nvidia-l4t-apt-source.clean.list /tmp/apt/nvidia-l4t-apt-source.clean.list
#
# install CUDA Toolkit
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
cuda-toolkit-* \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#
# install cuDNN
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcudnn*-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#
# Install build tools, build dependencies and python
#
RUN apt-get update && apt-get upgrade -y &&\
apt-get install -y \
python3-pip \
build-essential \
cmake \
git \
curl \
nano \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libavformat-dev \
libpq-dev \
libxine2-dev \
libglew-dev \
libtiff5-dev \
zlib1g-dev \
libjpeg-dev \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libpostproc-dev \
libswscale-dev \
libeigen3-dev \
libtbb-dev \
libgtk2.0-dev \
pkg-config \
lsb-release \
gnupg2 \
ca-certificates \
figlet \
## Python
python-dev \
python-numpy \
python3-dev \
python3-pip \
python3-numpy \
python3-matplotlib \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --no-cache-dir --verbose numpy
#
# Install OpenCV
#
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libopencv-dev=4.2.0+dfsg-5 \
python3-opencv \
&& rm -rf /var/lib/apt/lists/*
#
# ROS Noetic
#
ENV ROS_DISTRO=noetic
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV ROS_PYTHON_VERSION=3
WORKDIR /workspace
# add the ROS deb repo to the apt sources list
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
# install ROS packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ros-noetic-desktop-full \
ros-noetic-image-transport \
ros-noetic-vision-msgs \
python3-rosdep \
python3-rosinstall \
python3-rosinstall-generator \
python3-wstool \
&& rm -rf /var/lib/apt/lists/*
# init/update rosdep
RUN apt-get update && \
cd ${ROS_ROOT} && \
rosdep init && \
rosdep update && \
rm -rf /var/lib/apt/lists/*
# Install catkin tools
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-catkin-tools \
&& rm -rf /var/lib/apt/lists/*
# setup entrypoint
COPY viplanner/bin/packages/ros_entrypoint.sh /ros_entrypoint.sh
RUN echo 'source /opt/ros/${ROS_DISTRO}/setup.bash' >> /root/.bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
WORKDIR /
WORKDIR /root
#
# install prerequisites (many of these are for numpy)
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-pip \
python3-dev \
libopenblas-dev \
libopenmpi-dev \
openmpi-bin \
openmpi-common \
gfortran \
libomp-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN pip3 install --no-cache-dir setuptools Cython wheel
RUN pip3 install --no-cache-dir --verbose numpy
ENV LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:$LD_LIBRARY_PATH
#
# PyTorch (for JetPack 5.0.1 DP)
#
# latest pytorch version that has distributed support for jetson (necessary for mmdet)
ARG PYTORCH_URL=https://nvidia.box.com/shared/static/ssf2v7pf5i245fk4i0q926hy4imzs2ph.whl
ARG PYTORCH_WHL=torch-1.11.0-cp38-cp38-linux_aarch64.whl
RUN wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PYTORCH_URL} -O ${PYTORCH_WHL} && \
pip3 install --no-cache-dir --verbose ${PYTORCH_WHL} && \
rm ${PYTORCH_WHL}
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
apt-transport-https \
ca-certificates \
gnupg \
lsb-release \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# note: cmake is currently pinned to 3.22.3 because of https://github.com/pytorch/pytorch/issues/74955
RUN pip3 install --upgrade --no-cache-dir --verbose cmake==3.22.3
RUN cmake --version
# patch for https://github.com/pytorch/pytorch/issues/45323
RUN PYTHON_ROOT=`pip3 show torch | grep Location: | cut -d' ' -f2` && \
TORCH_CMAKE_CONFIG=$PYTHON_ROOT/torch/share/cmake/Torch/TorchConfig.cmake && \
echo "patching _GLIBCXX_USE_CXX11_ABI in ${TORCH_CMAKE_CONFIG}" && \
sed -i 's/ set(TORCH_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=")/ set(TORCH_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0")/g' ${TORCH_CMAKE_CONFIG}
ENV LLVM_CONFIG="/usr/bin/llvm-config-9"
ARG MAKEFLAGS=-j$(nproc)
ARG PYTHON3_VERSION=3.8
RUN printenv
#
# install further requirements
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
liblapack-dev \
libblas-dev \
libhdf5-serial-dev \
hdf5-tools \
libhdf5-dev \
zip \
libjpeg8-dev \
libopenmpi3 \
protobuf-compiler \
libprotoc-dev \
llvm-9 \
llvm-9-dev \
libffi-dev \
libsndfile1 \
vim \
libusb-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#
# python pip packages
#
RUN pip3 install --no-cache-dir --ignore-installed pybind11
RUN pip3 install --no-cache-dir --verbose ipython
RUN pip3 install --no-cache-dir --verbose opencv-python==4.5.5.64
#
# VIPlanner specific files
#
ENV CUDA_HOME='/usr/local/cuda'
RUN pip3 install --no-cache-dir --verbose mmcv==2.0.0 -f https://download.openmmlab.com/mmcv/dist/cu117/torch2.0/index.html
# install viplanner in edible mode (needed update of pip and setuptools) --> update viplanner without rebuilding the image
COPY viplanner /viplanner
RUN pip3 install --upgrade pip
RUN pip3 install setuptools==66.0.0
RUN pip3 install git+https://github.com/cocodataset/panopticapi.git
# FIX for PyYAML 6.0.0 install error (see README.md)
RUN pip3 install --ignore-installed PyYAML==6.0.0
# FIX since pypose requires torch that is not available on jetson with cuda and torch.distributed available
# FIX pypose requires version 0.3.6 for torch < 2.0.x and work with toch 1.11
RUN pip3 install --no-dependencies pypose==0.3.6
ENV PATH="$PATH:/root/.local/bin"
RUN pip3 install --user -e /viplanner/.[inference,jetson]
RUN pip3 install pillow==9.4.0
# ros-numpy
RUN apt-get update
RUN apt-get install ros-noetic-ros-numpy