I build an image from a Dockerfile that sources a file and builds ws workspace with docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)" -t my_image .. But, the build fails on line #4 because cmake complains about some missing packages.If I comment out lines #3 and #4, build the image and then manually do lines #3 and #4 through connecting to the container via docker exec -it ... the build of ws workspace succeeds. It only tells me that source (line #3) fails though there are no errors during docker image build.
What am I missing here? Below is what I have tried.
Dockerfile
1. FROM ubuntu:20.04 ...2. WORKDIR /home/ws ... 3. RUN source /opt/ros/noetic/setup.bash4. RUN colcon buildWhat I tried:
- Adding
SHELL ["/bin/bash", "-c"]before line #3 - Changing line #3 to
RUN ["/bin/bash", "-c", "source /opt/ros/noetic/setup.bash"]