-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
126 lines (110 loc) · 3.53 KB
/
Copy pathDockerfile
File metadata and controls
126 lines (110 loc) · 3.53 KB
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
# Use Ubuntu 20.04 as base image (required for ROS2 Foxy)
FROM ubuntu:20.04
# Set environment variables to avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Lisbon
# --- ENABLE NVIDIA GRAPHICS CAPABILITIES ---
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics,display
# ------------------------------------------------
# Update package lists and install basic dependencies
RUN apt-get update && apt-get install -y \
curl \
gnupg2 \
lsb-release \
wget \
software-properties-common \
build-essential \
git \
python3 \
python3-pip \
python3-dev \
python3-opencv \
libopencv-dev \
libeigen3-dev \
libgl1-mesa-glx \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
mesa-utils \
libglib2.0-0 \
vim \
nano \
iproute2 \
tmux \
&& rm -rf /var/lib/apt/lists/*
# Set up ROS2 repository
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Update package lists and install ROS2 Foxy
# rosbridge suite for foxglove (exposing websockets)
# ros-foxy-gazebo-ros-pkgs for gazebo-ros integration
RUN apt-get update && apt-get install -y \
ros-foxy-desktop \
ros-foxy-gazebo-ros-pkgs \
ros-foxy-xacro \
ros-foxy-ros2-control \
ros-foxy-ros2-controllers \
ros-foxy-gazebo-ros2-control \
ros-foxy-robot-localization \
ros-foxy-rosbridge-suite \
python3-rosdep \
python3-colcon-common-extensions \
python3-vcstool \
ros-foxy-geometry-msgs \
ros-foxy-sensor-msgs \
ros-foxy-std-msgs \
ros-foxy-nav-msgs \
ros-foxy-nmea-msgs \
&& rm -rf /var/lib/apt/lists/*
# Initialize rosdep
RUN rosdep init && rosdep update
# Install Eigen from source
WORKDIR /tmp
RUN wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz && \
tar -xzf eigen-3.4.0.tar.gz && \
cd eigen-3.4.0 && \
mkdir build && cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && \
make -j$(nproc) && \
make install
# Install GTSAM
WORKDIR /tmp
RUN git clone --branch 4.2.0 --depth 1 https://github.com/borglab/gtsam.git && \
cd gtsam && \
mkdir build && cd build && \
cmake .. \
-DGTSAM_BUILD_EXAMPLES=OFF \
-DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \
-DGTSAM_BUILD_TESTS=OFF \
-DGTSAM_BUILD_UNSTABLE=OFF \
-DGTSAM_USE_SYSTEM_EIGEN=ON \
-DGTSAM_WITH_TBB=OFF \
-DCMAKE_INSTALL_PREFIX=/usr/local && \
make -j$(nproc) && \
make install && \
ldconfig
# Install Python libraries
RUN pip3 install --upgrade pip
RUN pip3 install --ignore-installed psutil \
numpy \
transforms3d \
scikit-learn \
filterpy \
gtsam \
ultralytics \
casadi \
bezier
# Set up ROS2 environment
RUN echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
# Create a workspace directory
RUN mkdir -p /opt/share/workspace
WORKDIR /opt/share/workspace
# Copy the project files (uncomment this if you want to copy your project)
# COPY . /opt/share/workspace
# append things from .bashrc.example to .bashrc
COPY .bashrc.example /tmp/.bashrc.example
RUN cat /tmp/.bashrc.example >> ~/.bashrc
# Set the default command to source ROS2 and start bash
CMD ["bash", "-c", "source /opt/ros/foxy/setup.bash && bash"]