Skip to content

Commit 1296fac

Browse files
committed
Add humbleRPI image
1 parent bb19647 commit 1296fac

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed

DockerfileHumbleRPI

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
ARG image_base=arm64v8/ros:humble
2+
ARG registry=registry.klepsydra.io/repository
3+
ARG board=amd64
4+
ARG osrelease=jammy
5+
6+
FROM $image_base as system_dep
7+
8+
ENV TZ 'Europe/Madrid'
9+
ENV LC_ALL en_US.UTF-8
10+
ENV LANG en_US.UTF-8
11+
ENV LANGUAGE en_US.UTF-8
12+
ENV DEBIAN_FRONTEND=noninteractive
13+
RUN groupadd --gid 10000 kpsruser && \
14+
useradd --uid 10000 --gid kpsruser --shell /bin/bash --create-home kpsruser && \
15+
usermod -aG sudo kpsruser && \
16+
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
17+
18+
RUN apt update && apt-get -y install openssh-client
19+
RUN mkdir -p -m 0700 ~/.ssh
20+
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
21+
22+
ENV BUILD_MODE=Release
23+
24+
ARG OPENSSLVERSION="OpenSSL_1_1_1i"
25+
RUN git clone https://github.com/openssl/openssl.git && \
26+
cd openssl && git checkout ${OPENSSLVERSION} && \
27+
./config -fPIC shared && \
28+
make -j$(nproc) && \
29+
make install && \
30+
cd ../ && rm -rf openssl
31+
32+
33+
34+
RUN apt-get -y install libtool
35+
36+
ARG PROTOBUFVERSION="v3.19.0"
37+
RUN git clone https://github.com/protocolbuffers/protobuf.git && \
38+
cd protobuf && \
39+
git checkout ${PROTOBUFVERSION} && \
40+
git submodule update --init --recursive && \
41+
./autogen.sh && ./configure && \
42+
make -j$(nproc) && \
43+
sudo make install && ldconfig && \
44+
cd ../../ && \
45+
rm -rf protobuf
46+
47+
ARG EIGENVERSION="3.4.0"
48+
RUN git clone https://gitlab.com/libeigen/eigen.git && \
49+
cd eigen && \
50+
git checkout ${EIGENVERSION} && \
51+
mkdir build && cd build && \
52+
cmake -DCMAKE_BUILD_TYPE=Release ../ && \
53+
make -j$(nproc) && \
54+
sudo make install && \
55+
cd ../../ && \
56+
rm -rf eigen
57+
58+
ARG OPENCVVERSION="3.4.17"
59+
RUN git clone https://github.com/opencv/opencv.git && \
60+
cd opencv && \
61+
git checkout ${OPENCVVERSION} && \
62+
mkdir build && cd build && \
63+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DINSTALL_TESTS=OFF -DINSTALL_PYTHON_EXAMPLES=OFF -DINSTALL_C_EXAMPLES=OFF -DBUILD_opencv_apps=OFF ../ && \
64+
make -j$(nproc) && \
65+
sudo make install && \
66+
cd ../../ && \
67+
rm -rf opencv
68+
69+
ARG BENCHMARKVERSION="3b3de69400164013199ea448f051d94d7fc7d81f"
70+
RUN git clone https://github.com/google/benchmark.git && \
71+
cd benchmark && \
72+
git checkout ${BENCHMARKVERSION} && \
73+
mkdir build && cd build && \
74+
cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../ && \
75+
make -j$(nproc) && \
76+
make install && \
77+
cd ../../ && \
78+
rm -rf benchmark
79+
80+
ARG ZMQVERSION="v4.3.4"
81+
RUN git clone https://github.com/zeromq/libzmq.git && \
82+
cd libzmq && \
83+
git checkout ${ZMQVERSION} && \
84+
mkdir build && \
85+
cd build && \
86+
cmake ../ && \
87+
make -j$(nproc) && \
88+
make install && \
89+
cd ../../ && rm -rf libzmq
90+
91+
ARG ZMQCPPVERSION="v4.8.0"
92+
RUN git clone https://github.com/zeromq/cppzmq.git && \
93+
cd cppzmq && \
94+
git checkout ${ZMQCPPVERSION} && \
95+
mkdir build && cd build && \
96+
cmake ../ && \
97+
make -j$(nproc) && \
98+
make install && \
99+
cd ../../ && rm -rf cppzmq
100+
ARG YAMLCPPVERSION="yaml-cpp-0.7.0"
101+
RUN git clone https://github.com/jbeder/yaml-cpp && \
102+
cd yaml-cpp && git checkout ${YAMLCPPVERSION} && \
103+
mkdir build && \
104+
cd build && \
105+
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DYAML_CPP_BUILD_TESTS=Off ../ && \
106+
make -j$(nproc) && \
107+
make install && \
108+
cd ../../ && rm -rf yaml-cpp
109+
110+
USER root
111+
WORKDIR /home/kpsruser
112+
RUN <<EOF
113+
# echo "deb https://${registry}/${board}/ ${osrelease} main" >> /etc/apt/sources.list.d/klepsydra.list
114+
# apt-key add /tmp/public.gpg.key
115+
# rm /tmp/public.gpg.key
116+
# apt update
117+
apt-get -y install python3-pip
118+
pip config set global.extra-index-url https://registry.klepsydra.io/repository/kpe-pypi/simple
119+
pip install kpsr-codegen
120+
EOF
121+
122+
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
123+
124+
FROM system_dep as kpe-core
125+
126+
127+
128+
ENV KPE_CORE_TAG=v8.0.0
129+
RUN --mount=type=ssh git clone --branch ${KPE_CORE_TAG} --recurse-submodules git@github.com:klepsydra-technologies/kpe-core
130+
RUN --mount=type=cache,target=/home/kpsruser/.ccache <<EOF
131+
cd /home/kpsruser/kpe-core
132+
# Patch to make it work.
133+
sed -i 's/set(_SPDLOG_VERSION "1.5")/set(_SPDLOG_VERSION "1.9.2")/g' CMakeLists.txt
134+
mkdir build
135+
cd build
136+
cmake -DKPSR_WITH_YAML=false -DKPSR_WITH_SOCKET=true -DCMAKE_BUILD_TYPE=${BUILD_MODE} -DKPSR_WITH_ROS_HUMBLE_OR_ABOVE=true \
137+
-DKPSR_TEST_PERFORMANCE=false ../
138+
make -j
139+
sudo make install
140+
EOF
141+
142+
FROM kpe-core as kpe-admin
143+
ENV KPE_ADMIN_TAG=v7.0.0
144+
RUN --mount=type=ssh git clone --branch ${KPE_ADMIN_TAG} --recurse-submodules git@github.com:klepsydra-technologies/kpe-admin
145+
RUN --mount=type=cache,target=/home/kpsruser/.ccache <<EOF
146+
#apt-get -y install libbsd-dev
147+
cd /home/kpsruser/kpe-admin
148+
sed -i '26d' modules/system/src/cpu_reader_linux.cpp
149+
apt-get -y install glibc
150+
mkdir build && cd build &&
151+
cmake -DKPSR_WITH_SOCKET=true -DKPSR_NO_LICENSE=true -DCMAKE_BUILD_TYPE=${BUILD_MODE} ../ &&
152+
make -j$(nproc) &&
153+
sudo make install
154+
EOF
155+
156+
157+
FROM kpe-admin as kpe-streaming
158+
ENV KPE_STREAMING_VER=v11.1.0
159+
RUN --mount=type=ssh git clone --branch ${KPE_STREAMING_VER} --recurse-submodules git@github.com:klepsydra-technologies/kpe-streaming
160+
RUN --mount=type=cache,target=/home/kpsruser/.ccache <<EOF
161+
cd /home/kpsruser/kpe-streaming
162+
mkdir build && cd build &&
163+
cmake -DCMAKE_BUILD_TYPE=${BUILD_MODE} ../ &&
164+
make -j$(nproc) &&
165+
sudo make install
166+
EOF
167+
168+
# Install colcon, rosdep and dependencies
169+
FROM kpe-streaming as kpe-ros2-core
170+
ENV KPE_ROS2_CORE_BRANCH=humble
171+
RUN --mount=type=ssh git clone --branch ${KPE_ROS2_CORE_BRANCH} --recurse-submodules git@github.com:klepsydra-technologies/kpe-ros2-core.git
172+
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
173+
174+
RUN --mount=type=cache,target=/home/kpsruser/.ccache <<EOF
175+
pip install -U rosdep
176+
rosdep init && rosdep update --include-eol-distros
177+
178+
. /opt/ros/humble/local_setup.sh
179+
mkdir -p /home/kpsruser/kpe-ros2-core-install/src
180+
ln -s /home/kpsruser/kpe-ros2-core/ /home/kpsruser/kpe-ros2-core-install/src/kpe-ros2-core
181+
cd /home/kpsruser/kpe-ros2-core-install/
182+
rosdep install --from-paths src --ignore-src -r -y &&
183+
colcon build --cmake-args -DCMAKE_BUILD_TYPE=${BUILD_MODE}
184+
EOF
185+
186+
FROM kpe-ros2-core as reference_sytem
187+
ENV KPE_REF_SYSTEM=update_klepsydra_executor
188+
RUN --mount=type=ssh git clone --branch ${KPE_REF_SYSTEM} --recurse-submodules git@github.com:klepsydra-technologies/reference-system.git
189+
190+
RUN --mount=type=cache,target=/home/kpsruser/.ccache <<EOF
191+
apt-get -y install ros-humble-ros-testing
192+
mkdir -p /home/kpsruser/colcon_reference-system/src
193+
194+
ln -s /home/kpsruser/reference-system /home/kpsruser/colcon_reference-system/src/reference-system
195+
cd /home/kpsruser/colcon_reference-system/
196+
197+
. /opt/ros/humble/local_setup.sh
198+
colcon build --cmake-args -DCMAKE_PREFIX_PATH="/home/kpsruser/kpe-ros2-core-install/install" -DCMAKE_BUILD_TYPE=${BUILD_MODE} -DRUN_BENCHMARK=ON
199+
EOF
200+
201+
RUN apt-get -y install ros-humble-rmw-cyclonedds-cpp
202+
203+
# Necessary.
204+
ENV LD_LIBRARY_PATH=/home/kpsruser/kpe-ros2-core-install/install/kpsr_ros2_executor/lib:/usr/local/lib:/home/kpsruser/colcon_reference-system/install/reference_interfaces/lib:/opt/ros/humble/lib/x86_64-linux-gnu:/opt/ros/humble/lib
205+
206+
RUN sed -i 's/parallised/parallelised/g' /home/kpsruser/colcon_reference-system/src/reference-system/autoware_reference_system/src/ros2/data/streaming_policy.json
207+
# if this doesn't work YOU NEED TO MODIFY THE POLICY. parallised BECOMES parallelised.
208+
209+
USER kpsruser
210+
211+
RUN echo 'source /opt/ros/humble/setup.sh' >> /home/kpsruser/.bashrc &&
212+
echo 'source /home/kpsruser/colcon_reference-system/install/setup.sh' >> /home/kpsruser/.bashrc &&
213+
echo 'source /home/kpsruser/kpe-ros2-core-install/install/setup.sh' >> /home/kpsruser/.bashrc

0 commit comments

Comments
 (0)