How to source setup.bash in a ROS2 Dockerfile?
It seems that sourcing setup.bash in a ros2 dockerfile is not that easy. In particular,
RUN bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash \
&& echo ${AMENT_PREFIX_PATH}"
does not print anything although AMENT_PREFX_PATH got a value from setup.bash. I have to use the RUN [.., ..]
syntax. Is there an easier way to do so?
FROM ros:eloquent
#this one does not work
RUN bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash \
&& echo ${AMENT_PREFIX_PATH}"
#this one works, printing /opt/ros/eloquent
RUN ["/bin/bash", "-c", "source /opt/ros/${ROS_DISTRO}/setup.bash && echo ${AMENT_PREFIX_PATH}"]