-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile.CPU
131 lines (109 loc) · 4.54 KB
/
Dockerfile.CPU
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
FROM ubuntu:22.04
CMD ["/bin/bash"]
# Args for setting up non-root users, example command to use your own user:
# docker build -t <name: vtr3> \
# --build-arg USERID=$(id -u) \
# --build-arg GROUPID=$(id -g) \
# --build-arg USERNAME=$(whoami) \
# --build-arg HOMEDIR=${HOME} .
ARG GROUPID=0
ARG USERID=0
ARG USERNAME=root
ARG HOMEDIR=/root
RUN if [ ${GROUPID} -ne 0 ]; then addgroup --gid ${GROUPID} ${USERNAME}; fi \
&& if [ ${USERID} -ne 0 ]; then adduser --disabled-password --gecos '' --uid ${USERID} --gid ${GROUPID} ${USERNAME}; fi
# Default number of threads for make build
ARG NUMPROC=12
ENV DEBIAN_FRONTEND=noninteractive
## Switch to specified user to create directories
USER ${USERID}:${GROUPID}
ENV VTRROOT=${HOMEDIR}/ASRL/vtr3
ENV VTRSRC=${VTRROOT}/src \
VTRDATA=${VTRROOT}/data \
VTRTEMP=${VTRROOT}/temp \
VTRMODELS=${VTRROOT}/models \
GRIZZLY=${VTRROOT}/grizzly \
WARTHOG=${VTRROOT}/warthog \
VTRUI=${VTRSRC}/main/src/vtr_gui/vtr_gui/vtr-gui
RUN echo "alias build_ui='npm --prefix ${VTRUI} install ${VTRUI}; npm --prefix ${VTRUI} run build'" >> ~/.bashrc
RUN echo "alias build_vtr='source /opt/ros/humble/setup.bash; cd ${VTRSRC}/main; colcon build --symlink-install'" >> ~/.bashrc
## Switch to root to install dependencies
USER 0:0
## Dependencies
RUN apt update && apt upgrade -q -y
RUN apt update && apt install -q -y cmake git build-essential lsb-release curl gnupg2
RUN apt update && apt install -q -y libboost-all-dev libomp-dev
RUN apt update && apt install -q -y libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
RUN apt update && apt install -q -y freeglut3-dev
RUN apt update && apt install -q -y python3 python3-distutils python3-pip
RUN apt update && apt install -q -y libeigen3-dev
RUN apt update && apt install -q -y libsqlite3-dev sqlite3
RUN apt install -q -y libc6-dbg gdb valgrind
## Install PROJ (8.2.0) (this is for graph_map_server in vtr_navigation)
RUN apt update && apt install -q -y cmake libsqlite3-dev sqlite3 libtiff-dev libcurl4-openssl-dev
RUN mkdir -p ${HOMEDIR}/proj && cd ${HOMEDIR}/proj \
&& git clone https://github.com/OSGeo/PROJ.git . && git checkout 8.2.0 \
&& mkdir -p ${HOMEDIR}/proj/build && cd ${HOMEDIR}/proj/build \
&& cmake .. && cmake --build . -j${NUMPROC} --target install
ENV LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
## Install ROS2
# UTF-8
RUN apt install -q -y locales \
&& locale-gen en_US en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
# Add ROS2 key and install from Debian packages
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \
&& apt update && apt install -q -y ros-humble-desktop
## Install VTR specific ROS2 dependencies
RUN apt update && apt install -q -y \
ros-humble-xacro \
ros-humble-vision-opencv \
ros-humble-perception-pcl ros-humble-pcl-ros \
ros-humble-rmw-cyclonedds-cpp
RUN apt install ros-humble-tf2-tools
## Install misc dependencies
RUN apt update && apt install -q -y \
tmux \
nodejs npm protobuf-compiler \
libboost-all-dev libomp-dev \
libpcl-dev \
libcanberra-gtk-module libcanberra-gtk3-module \
libbluetooth-dev libcwiid-dev \
python3-colcon-common-extensions \
virtualenv \
texlive-latex-extra \
clang-format
## Install python dependencies
RUN pip3 install \
tmuxp \
pyyaml \
pyproj \
scipy \
zmq \
flask \
flask_socketio \
eventlet \
python-socketio \
python-socketio[client] \
websocket-client
RUN mkdir -p ${HOMEDIR}/.matplotcpp && cd ${HOMEDIR}/.matplotcpp \
&& git clone https://github.com/lava/matplotlib-cpp.git . \
&& mkdir -p ${HOMEDIR}/.matplotcpp/build && cd ${HOMEDIR}/.matplotcpp/build \
&& cmake .. && cmake --build . -j${NUMPROC} --target install
RUN apt install htop
RUN apt install ros-humble-velodyne -q -y
# Install vim
RUN apt update && apt install -q -y vim
#Install debugger
RUN apt install -q -y libc6-dbg gdb valgrind
##Install LibTorch
RUN curl https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip --output libtorch.zip
RUN unzip libtorch.zip -d /opt/torch
RUN rm libtorch.zip
ENV TORCH_LIB=/opt/torch/libtorch
ENV LD_LIBRARY_PATH=$TORCH_LIB/lib:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
ENV CMAKE_PREFIX_PATH=$TORCH_LIB:$CMAKE_PREFIX_PATH
## Switch to specified user
USER ${USERID}:${GROUPID}