-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.x86-dev
272 lines (248 loc) · 7.73 KB
/
Dockerfile.x86-dev
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
# x86 development DUA base unit.
#
# Roberto Masocco <r.masocco@dotxautomation.com>
#
# February 2, 2023
# Copyright 2024 dotX Automation s.r.l.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# BUILD THIS WITH:
# --network host
# Start from an amd64 Ubuntu 24.04 image
FROM --platform=linux/amd64 ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# Create internal users group
RUN groupadd -r internal
# Install basic utilities, dependencies, and development tools
# These include:
# - C/C++ toolchain and debuggers
# - Python 3 interpreter, testers, basic modules and scientific libraries
# - Linters
# - OpenCV dependencies for x86 systems
# - Boost C++ libraries
# - System utilities
# - Zsh shell
# - Nvidia video encode/decode libraries
# Then, add universe repository
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
ca-certificates \
ccache \
cmake \
cppcheck \
curl \
dialog \
dirmngr \
dmidecode \
file \
fuse3 \
g++ \
gcc \
gdb \
gdbserver \
git \
gnupg2 \
htop \
iproute2 \
less \
lcov \
libasio-dev \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libboost-all-dev \
libdc1394-dev \
libgeographiclib-dev \
libgtk2.0-dev \
libjpeg-dev \
libpng-dev \
libssl-dev \
libswresample-dev \
libswscale-dev \
libtbb-dev \
libtiff-dev \
libtinyxml2-dev \
libxml2-utils \
locales \
lsb-release \
lsof \
make \
minicom \
nano \
nfs-common \
ninja-build \
openssh-client \
openssl \
pkg-config \
python3 \
python3-argcomplete \
python3-autopep8 \
python3-dev \
python3-pip \
python3-pygments \
python3-pytest-pylint \
python3-venv \
shellcheck \
software-properties-common \
sshfs \
sudo \
uncrustify \
unzip \
valgrind \
vim \
wget \
whois \
zip \
zsh \
zsh-doc && \
add-apt-repository universe && \
apt-get autoremove -y && \
apt-get autoclean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*/apt/lists/*
# Configure Git to accept different ownerships for local repository clones
RUN git config --system --add safe.directory '*'
# Install Java 11
RUN apt-get update && apt-get install -y --no-install-recommends \
ant \
openjdk-11-jre \
openjdk-11-jdk \
libvecmath-java && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*/apt/lists/* && \
update-alternatives --set java $(update-alternatives --list java | grep "java-11")
# Configure language and locale
RUN locale-gen en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
# Configure CMake system-wide environment to detect our installations first
ENV CMAKE_PREFIX_PATH=/usr/local
# Install ROS 2
WORKDIR /opt
COPY scripts/ros2/install_ros2.x86-dev.sh /opt/install_ros2.sh
RUN /opt/install_ros2.sh jazzy && \
chgrp internal /opt/install_ros2.sh && \
chmod g+rwx /opt/install_ros2.sh && \
chgrp -R internal /opt/ros && \
chmod -R g+rw /opt/ros
WORKDIR /root
# Configure default ROS MiddleWare implementation
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# Install Gazebo
WORKDIR /opt
COPY scripts/ros2/install_gazebo.x86-dev.sh /opt/install_gazebo.sh
RUN /opt/install_gazebo.sh harmonic jazzy && \
chgrp internal /opt/install_gazebo.sh && \
chmod g+rwx /opt/install_gazebo.sh
WORKDIR /root
# Create a Python virtual environment and install packages in it
WORKDIR /opt
RUN --mount=type=bind,source=python/requirements.txt,target=/opt/requirements.txt --mount=type=bind,source=python/requirements_dev.txt,target=/opt/requirements_dev.txt \
python3 -m venv --system-site-packages dua-venv && \
. dua-venv/bin/activate && \
pip install -U -r requirements.txt -r requirements_dev.txt && \
chgrp -R internal /opt/dua-venv && \
chmod -R g+rw /opt/dua-venv
WORKDIR /root
# Ensure that the Python environment is correctly sourced
# NOTE: System path is the output of:
# python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
ENV PYTHONPATH=/opt/dua-venv/lib/python3.12/site-packages:/usr/lib/python3/dist-packages
# Build and install Eigen
WORKDIR /opt
COPY scripts/eigen/build_eigen.sh /opt/build_eigen.sh
RUN . dua-venv/bin/activate && \
/opt/build_eigen.sh 3.4.0 && \
chgrp internal /opt/build_eigen.sh && \
chmod g+rwx /opt/build_eigen.sh && \
chgrp -R internal /opt/eigen && \
chmod -R g+rw /opt/eigen
WORKDIR /root
# Build and install OpenCV
WORKDIR /opt
COPY scripts/opencv/build_opencv.x86-dev.sh /opt/build_opencv.sh
RUN . dua-venv/bin/activate && \
/opt/build_opencv.sh 4.11.0 && \
chgrp internal /opt/build_opencv.sh && \
chmod g+rwx /opt/build_opencv.sh && \
chgrp -R internal /opt/opencv && \
chmod -R g+rw /opt/opencv && \
chgrp -R internal /opt/opencv_contrib && \
chmod -R g+rw /opt/opencv_contrib
WORKDIR /root
# Install Rust toolchain
ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/rust
WORKDIR /opt
COPY scripts/rust/install_rust.sh /opt/install_rust.sh
RUN . dua-venv/bin/activate && \
/opt/install_rust.sh 1.75.0 && \
chgrp internal /opt/install_rust.sh && \
chmod g+rwx /opt/install_rust.sh && \
chgrp -R internal /opt/rust && \
chmod -R g+rw /opt/rust
WORKDIR /root
# Install DDS implementations:
# - Fast DDS
# - Cyclone DDS
# NOTES
# - Only C/C++ libraries and support is installed.
# - The versions are fixed to the closest ones supported by ROS 2 Jazzy (below).
# - None of these installations goes to system paths, they remain confined
# within subdirectories of /opt/dds; see the scripts for details.
# In case you would like to use these libraries in your projects, you
# should configure CMake or whatever you use accordingly.
# This is to enable development with standalone DDS implementations while
# avoiding to create conflicts with the ROS 2 installation.
WORKDIR /opt
COPY scripts/dds/install_dds.x86-dev.sh /opt/install_dds.sh
RUN . dua-venv/bin/activate && \
/opt/install_dds.sh 2.14.4 0.10.5 && \
chgrp internal /opt/install_dds.sh && \
chmod g+rwx /opt/install_dds.sh && \
chgrp -R internal /opt/dds && \
chmod -R g+rw /opt/dds
WORKDIR /root
ENV PATH=/opt/dds/Fast-DDS/src/fastddsgen/scripts:/opt/dds/cyclonedds/install/bin:$PATH
# Install Zenoh
WORKDIR /opt
COPY scripts/zenoh/install_zenoh.x86-dev.sh /opt/install_zenoh.sh
RUN . dua-venv/bin/activate && \
/opt/install_zenoh.sh 1.2.1 && \
chgrp internal /opt/install_zenoh.sh && \
chmod g+rwx /opt/install_zenoh.sh && \
chgrp -R internal /opt/zenoh && \
chmod -R g+rw /opt/zenoh
WORKDIR /root
# Build and install dua-utils
# The ARG allows us to break cache and rebuild from here upon each new version
ARG DUA_UTILS_VERSION=20250322-1626
WORKDIR /opt
COPY scripts/ros2/build_dua_utils.sh /opt/build_dua_utils.sh
COPY scripts/ros2/dua-utils_repos_dev.yaml /opt/dua-utils_repos_dev.yaml
RUN . dua-venv/bin/activate && \
/opt/build_dua_utils.sh jazzy /opt/dua-utils_repos_dev.yaml && \
chgrp internal /opt/build_dua_utils.sh && \
chmod g+rwx /opt/build_dua_utils.sh && \
chgrp internal /opt/dua-utils_repos_dev.yaml && \
chmod g+rw /opt/dua-utils_repos_dev.yaml && \
chgrp -R internal /opt/ros/dua-utils && \
chmod -R g+rw /opt/ros/dua-utils
WORKDIR /root
# Mark image as complete
RUN mkdir -p /etc/dua && \
echo "x86-dev" > /etc/dua/target
ENV DEBIAN_FRONTEND=dialog
# Finalize image
LABEL description="DUA base unit for x86 development systems"
LABEL platform="linux/amd64"
CMD ["bash"]