I am working on building a custom docker image deployable to a Jetson nano. At the moment I am simply copying the src folder of the ros workspace and hope to build (including colcon build) it before pushing to the docker hub, so that i can simply pull on jetson nano side. Please help me to figure out what I am doing wrong. At the moment, ros_entrypoint.sh is as follows,
FROM dustynv/ros:humble-ros-base-l4t-r32.7.1
ENV WORKSPACE=/home/workspace
ENV ROS_VERSION=humble
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
WORKDIR /
RUN mkdir -p ${WORKSPACE}/src
COPY ./src ${WORKSPACE}/src
RUN cd ${WORKSPACE} && colcon build
# setup entrypoint
COPY ./ros_entrypoint.sh /ros_entrypoint.sh
RUN echo 'source /opt/ros/${ROS_DISTRO}/setup.bash' >> .bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
I get following error,
=> ERROR [4/7] RUN cd /home/workspace && colcon build 8.1s
------
> [4/7] RUN cd /home/workspace && colcon build:
3.063 Starting >>> test
7.872 --- stderr: test
7.872 CMake Error at CMakeLists.txt:9 (find_package):
7.872 By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
7.872 has asked CMake to find a package configuration file provided by
7.872 "ament_cmake", but CMake did not find one.
7.872
7.872 Could not find a package configuration file provided by "ament_cmake" with
7.872 any of the following names:
7.872
7.872 ament_cmakeConfig.cmake
7.872 ament_cmake-config.cmake
7.872
7.872 Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
7.872 "ament_cmake_DIR" to a directory containing one of the above files. If
7.872 "ament_cmake" provides a separate development package or SDK, be sure it
7.872 has been installed.
7.872
7.872
7.872 ---
7.873 Failed <<< test [4.81s, exited with code 1]
7.971
7.971 Summary: 0 packages finished [5.42s]
7.971 1 package failed: test
7.971 1 package had stderr output: test
------
jetsonnano-humble-darkent-ros.Dockerfile:13
--------------------
11 | COPY ./src ${WORKSPACE}/src
12 |
13 | >>> RUN cd ${WORKSPACE} && colcon build
14 |
15 | # setup entrypoint
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/bash -c cd ${WORKSPACE} && colcon build" did not complete successfully: exit code: 1
If i change the dockerfile to following,
FROM dustynv/ros:humble-ros-base-l4t-r32.7.1
ENV WORKSPACE=/home/workspace
ENV ROS_VERSION=humble
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
WORKDIR /
RUN mkdir -p ${WORKSPACE}/src
COPY ./src ${WORKSPACE}/src
RUN . ${ROS_ROOT}/setup.bash \
&& cd ${WORKSPACE} \
&& colcon build
# setup entrypoint
COPY ./ros_entrypoint.sh /ros_entrypoint.sh
RUN echo 'source /opt/ros/${ROS_DISTRO}/setup.bash' >> .bashrc
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
The error changes to following
=> ERROR [4/7] RUN . /opt/ros/humble/setup.bash && cd /home/workspace && colcon build 0.2s
------
> [4/7] RUN . /opt/ros/humble/setup.bash && cd /home/workspace && colcon build:
0.124 /bin/bash: /opt/ros/humble/setup.bash: No such file or directory
------
jetsonnano-humble-darkent-ros.Dockerfile:13
--------------------
12 |
13 | >>> RUN . ${ROS_ROOT}/setup.bash \
14 | >>> && cd ${WORKSPACE} \
15 | >>> && colcon build
16 |
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/bash -c . ${ROS_ROOT}/setup.bash && cd ${WORKSPACE} && colcon build" did not complete successfully: exit code: 1
I am working on building a custom docker image deployable to a Jetson nano. At the moment I am simply copying the src folder of the ros workspace and hope to build (including colcon build) it before pushing to the docker hub, so that i can simply pull on jetson nano side. Please help me to figure out what I am doing wrong. At the moment, ros_entrypoint.sh is as follows,
When i use the following dockerfile,
I get following error,
If i change the dockerfile to following,
The error changes to following
If I change the ros_entrypoint.sh to
and Dockerfile to
It succeeds with following output.
But it defeats the purpose of offloading the compiling from the jetson nano i guess. I am attempting to build this via buildx on a amd64 machine.
Is there a way to build this and push to docker hub as i need or, is the last approach only viable?