FROM rapidposetriangulation WORKDIR / # Install ONNX runtime # See: https://github.com/microsoft/onnxruntime/blob/main/dockerfiles/Dockerfile.tensorrt RUN pip3 uninstall -y onnxruntime-gpu RUN git clone --recursive --depth=1 --branch=v1.20.1 https://github.com/Microsoft/onnxruntime.git ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:/cmake-3.30.1-linux-x86_64/bin:${PATH} ARG CMAKE_CUDA_ARCHITECTURES=75;80;90 ENV TRT_VERSION=10.5.0.18 RUN /bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh RUN /bin/sh onnxruntime/dockerfiles/scripts/checkout_submodules.sh ${trt_version} RUN ls RUN cd onnxruntime && \ /bin/sh build.sh --allow_running_as_root --parallel --build_shared_lib \ --cuda_home /usr/local/cuda --cudnn_home /usr/lib/x86_64-linux-gnu/ --use_tensorrt \ --tensorrt_home /usr/lib/x86_64-linux-gnu/ --config Release --build_wheel --skip_tests \ --skip_submodule_sync --cmake_extra_defines '"CMAKE_CUDA_ARCHITECTURES='${CMAKE_CUDA_ARCHITECTURES}'"' RUN cd onnxruntime && pip install build/Linux/Release/dist/*.whl # Install ROS2 # https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html RUN apt-get update && apt-get install -y --no-install-recommends locales RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common RUN add-apt-repository universe RUN apt-get update && apt-get install -y --no-install-recommends curl RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" > /etc/apt/sources.list.d/ros2.list RUN apt-get update && apt-get install -y --no-install-recommends ros-humble-ros-base python3-argcomplete RUN apt-get update && apt-get install -y --no-install-recommends ros-dev-tools RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc # Create ROS2 workspace for basic packages RUN mkdir -p /project/base/src/ RUN cd /project/base/; colcon build RUN echo "source /project/base/install/setup.bash" >> ~/.bashrc # Install opencv and cv_bridge RUN apt-get update && apt-get install -y --no-install-recommends libboost-dev RUN apt-get update && apt-get install -y --no-install-recommends libboost-python-dev RUN apt-get update && apt-get install -y --no-install-recommends libopencv-dev RUN cd /project/base/src/; git clone --branch humble --depth=1 https://github.com/ros-perception/vision_opencv.git RUN /bin/bash -i -c 'cd /project/base/; colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release' # Install ROS2 image viewer RUN cd /project/base/src/; git clone --branch=humble --depth=1 https://github.com/ros-perception/image_pipeline.git RUN cd /project/base/src/; git clone --branch=humble --depth=1 https://github.com/ros-perception/image_common.git RUN /bin/bash -i -c 'cd /project/base/; colcon build --symlink-install --packages-select camera_calibration_parsers image_transport image_view --cmake-args -DCMAKE_BUILD_TYPE=Release' # Fix module not found error when displaying images RUN apt-get update && apt-get install -y --no-install-recommends libcanberra-gtk-module libcanberra-gtk3-module # Create ROS2 workspace for project packages RUN mkdir -p /project/dev_ws/src/ RUN cd /project/dev_ws/; colcon build RUN echo "source /project/dev_ws/install/setup.bash" >> ~/.bashrc # Fix ros package building error RUN pip3 install --no-cache-dir "setuptools<=58.2.0" # Copy modules COPY ./extras/include/ /RapidPoseTriangulation/extras/include/ COPY ./scripts/ /RapidPoseTriangulation/scripts/ COPY ./extras/ros/pose2d_visualizer/ /RapidPoseTriangulation/extras/ros/pose2d_visualizer/ COPY ./extras/ros/rpt2d_wrapper_cpp/ /RapidPoseTriangulation/extras/ros/rpt2d_wrapper_cpp/ # Link and build as ros package RUN ln -s /RapidPoseTriangulation/extras/ros/pose2d_visualizer/ /project/dev_ws/src/pose2d_visualizer RUN ln -s /RapidPoseTriangulation/extras/ros/rpt2d_wrapper_cpp/ /project/dev_ws/src/rpt2d_wrapper_cpp RUN /bin/bash -i -c 'cd /project/dev_ws/; colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release' # Update ros packages -> autocompletion and check RUN /bin/bash -i -c 'ros2 pkg list' # Clear cache to save space, only has an effect if image is squashed RUN apt-get autoremove -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /RapidPoseTriangulation/ CMD ["/bin/bash"]