|
@@ -4,29 +4,59 @@
|
|
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
#
|
|
#
|
|
|
|
|
|
-FROM ros:humble-ros-core-jammy
|
|
|
|
|
|
+# Collect the arguments for the base ros image
|
|
|
|
+ARG ROS_VERSION=humble
|
|
|
|
+ARG UBUNTU_VERSION=jammy
|
|
|
|
|
|
-ENV WORKDIR=/data/workspace
|
|
|
|
-WORKDIR $WORKDIR
|
|
|
|
|
|
+FROM ros:${ROS_VERSION}-ros-base-${UBUNTU_VERSION}
|
|
|
|
|
|
|
|
+ARG ROS_VERSION
|
|
|
|
+ARG UBUNTU_VERSION
|
|
|
|
+
|
|
|
|
+# Argument to control the type of docker image to build
|
|
|
|
+ARG IMAGE_TYPE=simulation # Default to 'simulation'
|
|
|
|
+
|
|
|
|
+# Arguments for the source repos
|
|
|
|
+ARG O3DE_REPO=https://github.com/o3de/o3de.git
|
|
|
|
+ARG O3DE_BRANCH=development
|
|
|
|
+
|
|
|
|
+ARG O3DE_EXTRAS_REPO=https://github.com/o3de/o3de-extras.git
|
|
|
|
+ARG O3DE_EXTRAS_BRANCH=development
|
|
|
|
+
|
|
|
|
+ARG ROSCON_DEMO_REPO=https://github.com/o3de/ROSConDemo.git
|
|
|
|
+ARG ROSCON_DEMO_BRANCH=main
|
|
|
|
+
|
|
|
|
+# Additional argument to control build concurrency
|
|
|
|
+ARG CMAKE_JOBS=8
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
+ENV WORKSPACE=/data/workspace
|
|
|
|
+
|
|
|
|
+WORKDIR $WORKSPACE
|
|
|
|
+
|
|
|
|
+# Verify only the supported ROS2 versions was specified
|
|
|
|
+RUN if [ "${ROS_VERSION}" = "humble" ]; then \
|
|
|
|
+ echo "Building ROS2/Humble based image"; \
|
|
|
|
+ elif [ "${ROS_VERSION}" = "galactic" ]; then \
|
|
|
|
+ echo "Building ROS2/Galactic based image"; \
|
|
|
|
+ else \
|
|
|
|
+ echo "Unsupported ROS_VERSION: ${ROS_VERSION}" && exit 1; \
|
|
|
|
+ fi
|
|
|
|
+
|
|
# Setup time zone and locale data (necessary for SSL and HTTPS packages)
|
|
# Setup time zone and locale data (necessary for SSL and HTTPS packages)
|
|
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get -y \
|
|
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get -y \
|
|
install \
|
|
install \
|
|
tzdata \
|
|
tzdata \
|
|
locales \
|
|
locales \
|
|
keyboard-configuration \
|
|
keyboard-configuration \
|
|
- && rm -rf /var/lib/apt/lists/*
|
|
|
|
-
|
|
|
|
-RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
|
|
|
|
|
+ && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
|
|
&& dpkg-reconfigure --frontend=noninteractive locales \
|
|
&& dpkg-reconfigure --frontend=noninteractive locales \
|
|
- && update-locale LANG=en_US.UTF-8
|
|
|
|
|
|
+ && update-locale LANG=en_US.UTF-8 \
|
|
|
|
+ && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
ENV LANG=en_US.UTF-8
|
|
ENV LANG=en_US.UTF-8
|
|
|
|
|
|
-# Install common tools
|
|
|
|
-# deps in https://github.com/o3de/o3de/blob/development/scripts/build/build_node/Platform/Linux/package-list.ubuntu-jammy.txt
|
|
|
|
|
|
+# Install the required ubuntu packages
|
|
RUN apt-get update && apt-get install -y \
|
|
RUN apt-get update && apt-get install -y \
|
|
bc \
|
|
bc \
|
|
bind9-utils \
|
|
bind9-utils \
|
|
@@ -34,6 +64,7 @@ RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
ca-certificates \
|
|
clang \
|
|
clang \
|
|
cmake \
|
|
cmake \
|
|
|
|
+ curl \
|
|
file \
|
|
file \
|
|
firewalld \
|
|
firewalld \
|
|
git \
|
|
git \
|
|
@@ -70,81 +101,149 @@ RUN apt-get update && apt-get install -y \
|
|
xz-utils \
|
|
xz-utils \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
-# Gem + ROSConDemo ROS pacakges
|
|
|
|
-RUN apt-get update && apt-get install -y \
|
|
|
|
- ros-humble-ackermann-msgs \
|
|
|
|
- ros-humble-control-toolbox \
|
|
|
|
- ros-humble-gazebo-msgs \
|
|
|
|
- ros-humble-joy \
|
|
|
|
- ros-humble-navigation2 \
|
|
|
|
- ros-humble-rviz2 \
|
|
|
|
- ros-humble-tf2-ros \
|
|
|
|
- ros-humble-urdfdom \
|
|
|
|
- ros-humble-vision-msgs \
|
|
|
|
- && rm -rf /var/lib/apt/lists/*
|
|
|
|
-
|
|
|
|
-## Symlink clang version to non-versioned clang and set cc to clang
|
|
|
|
-RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 \
|
|
|
|
- && update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
|
|
|
|
|
|
+# Setup and install the ROS packages
|
|
|
|
+RUN sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' \
|
|
|
|
+ && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
|
|
|
|
|
|
-# Assumes a local checkout of private ROSConDemo
|
|
|
|
-RUN git clone https://github.com/o3de/ROSConDemo.git \
|
|
|
|
- && cd ROSConDemo \
|
|
|
|
- && git lfs install \
|
|
|
|
- && git lfs pull
|
|
|
|
-
|
|
|
|
-# Install o3de
|
|
|
|
-RUN git clone https://github.com/o3de/o3de.git -b development \
|
|
|
|
- && cd o3de \
|
|
|
|
- && git lfs install \
|
|
|
|
- && git lfs pull \
|
|
|
|
- && python/get_python.sh
|
|
|
|
-
|
|
|
|
-RUN git clone https://github.com/o3de/o3de-extras.git -b development
|
|
|
|
-
|
|
|
|
-RUN ./o3de/scripts/o3de.sh register --this-engine \
|
|
|
|
- && ./o3de/scripts/o3de.sh register --gem-path ./o3de-extras/Gems/ROS2 \
|
|
|
|
- && ./o3de/scripts/o3de.sh register -pp ./ROSConDemo/Project \
|
|
|
|
- && ./o3de/scripts/o3de.sh enable-gem -gn ROS2 -pp ./ROSConDemo/Project \
|
|
|
|
- && cat /root/.o3de/o3de_manifest.json
|
|
|
|
-
|
|
|
|
-WORKDIR $WORKDIR/ROSConDemo/Project
|
|
|
|
-
|
|
|
|
-RUN git lfs pull \
|
|
|
|
- && . /opt/ros/humble/setup.sh \
|
|
|
|
- && cmake -B build/linux -S . -G "Ninja Multi-Config" -DLY_DISABLE_TEST_MODULES=ON -DLY_STRIP_DEBUG_SYMBOLS=ON
|
|
|
|
-
|
|
|
|
-RUN . /opt/ros/humble/setup.sh \
|
|
|
|
- && cmake --build build/linux --config profile --target ROSConDemo Editor AssetProcessor
|
|
|
|
-
|
|
|
|
-# This final step takes long since they Assets will be downloading
|
|
|
|
-RUN . /opt/ros/humble/setup.sh \
|
|
|
|
- && echo "This final step can take more than 1 hour. Good time for going for a coffee :)" \
|
|
|
|
- && cmake --build build/linux --config profile --target ROSConDemo.Assets
|
|
|
|
-
|
|
|
|
-# Installing o3de_kraken_nav
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
+ ros-${ROS_DISTRO}-ackermann-msgs \
|
|
|
|
+ ros-${ROS_DISTRO}-control-toolbox \
|
|
|
|
+ ros-${ROS_DISTRO}-gazebo-msgs \
|
|
|
|
+ ros-${ROS_DISTRO}-joy \
|
|
|
|
+ ros-${ROS_DISTRO}-navigation2 \
|
|
|
|
+ ros-${ROS_DISTRO}-rviz2 \
|
|
|
|
+ ros-${ROS_DISTRO}-tf2-ros \
|
|
|
|
+ ros-${ROS_DISTRO}-urdfdom \
|
|
|
|
+ ros-${ROS_DISTRO}-vision-msgs \
|
|
python3-colcon-common-extensions \
|
|
python3-colcon-common-extensions \
|
|
- ros-humble-cyclonedds \
|
|
|
|
- ros-humble-rmw-cyclonedds-cpp \
|
|
|
|
- ros-humble-slam-toolbox \
|
|
|
|
- ros-humble-navigation2 \
|
|
|
|
- ros-humble-nav2-bringup \
|
|
|
|
- ros-humble-pointcloud-to-laserscan \
|
|
|
|
- ros-humble-teleop-twist-keyboard \
|
|
|
|
- ros-humble-ackermann-msgs \
|
|
|
|
- ros-humble-topic-tools \
|
|
|
|
- && rm -rf /var/lib/apt/lists/*
|
|
|
|
-
|
|
|
|
-RUN pip install python-statemachine
|
|
|
|
-
|
|
|
|
-WORKDIR $WORKDIR
|
|
|
|
-
|
|
|
|
-RUN mkdir -p o3de_kraken_ws/src \
|
|
|
|
- && cd o3de_kraken_ws/src \
|
|
|
|
- && ln -s $WORKDIR/ROSConDemo/kraken_nav kraken_nav
|
|
|
|
-
|
|
|
|
-RUN cd o3de_kraken_ws \
|
|
|
|
- && colcon build --symlink-install
|
|
|
|
|
|
+ ros-${ROS_DISTRO}-cyclonedds \
|
|
|
|
+ ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
|
|
|
|
+ ros-${ROS_DISTRO}-slam-toolbox \
|
|
|
|
+ ros-${ROS_DISTRO}-navigation2 \
|
|
|
|
+ ros-${ROS_DISTRO}-nav2-bringup \
|
|
|
|
+ ros-${ROS_DISTRO}-pointcloud-to-laserscan \
|
|
|
|
+ ros-${ROS_DISTRO}-teleop-twist-keyboard \
|
|
|
|
+ ros-${ROS_DISTRO}-ackermann-msgs \
|
|
|
|
+ ros-${ROS_DISTRO}-topic-tools \
|
|
|
|
+ && rm -rf /var/lib/apt/lists/* \
|
|
|
|
+ && pip install python-statemachine
|
|
|
|
+
|
|
|
|
+# Depending on the image type, sync, setup and build only whats needed
|
|
|
|
+RUN if [ "${IMAGE_TYPE}" = "full" ]; then \
|
|
|
|
+ git clone --recursive $O3DE_REPO $WORKSPACE/o3de \
|
|
|
|
+ && git -C $WORKSPACE/o3de checkout $O3DE_BRANCH \
|
|
|
|
+ && git -C $WORKSPACE/o3de lfs install \
|
|
|
|
+ && git -C $WORKSPACE/o3de lfs pull \
|
|
|
|
+ && $WORKSPACE/o3de/python/get_python.sh \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -ep $WORKSPACE/o3de \
|
|
|
|
+ && git clone $O3DE_EXTRAS_REPO \
|
|
|
|
+ && git -C $WORKSPACE/o3de-extras checkout $O3DE_EXTRAS_BRANCH \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/o3de-extras/Gems/ROS2 \
|
|
|
|
+ && git clone $ROSCON_DEMO_REPO \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo checkout $ROSCON_DEMO_BRANCH \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs install \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs pull \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/ROSConDemo/Project \
|
|
|
|
+ && . /opt/ros/humble/setup.sh \
|
|
|
|
+ && cd $WORKSPACE/ROSConDemo/Project \
|
|
|
|
+ && cmake -B $WORKSPACE/ROSConDemo/Project/build/linux -S . -G "Ninja Multi-Config" -DLY_DISABLE_TEST_MODULES=ON -DLY_STRIP_DEBUG_SYMBOLS=ON \
|
|
|
|
+ && cmake --build $WORKSPACE/ROSConDemo/Project/build/linux --config profile --target ROSConDemo.GameLauncher Editor ROSConDemo.Assets -j $CMAKE_JOBS \
|
|
|
|
+ && cd $WORKSPACE/ROSConDemo/kraken_nav \
|
|
|
|
+ && colcon build --symlink-install \
|
|
|
|
+ && rm -rf ~/.o3de/3rdParty/ \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/.git \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/AutomatedTesting \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/python/downloaded_packages \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/Code \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/Gems \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/Azcg/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/CMake \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/CMakeFiles/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/External/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/Testing/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/_deps/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/cmake \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/lib/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/o3de/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/packages/; \
|
|
|
|
+ elif [ "${IMAGE_TYPE}" = "simulation" ]; then \
|
|
|
|
+ git clone --recursive $O3DE_REPO $WORKSPACE/o3de \
|
|
|
|
+ && git -C $WORKSPACE/o3de checkout $O3DE_BRANCH \
|
|
|
|
+ && git -C $WORKSPACE/o3de lfs install \
|
|
|
|
+ && git -C $WORKSPACE/o3de lfs pull \
|
|
|
|
+ && $WORKSPACE/o3de/python/get_python.sh \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -ep $WORKSPACE/o3de \
|
|
|
|
+ && git clone $O3DE_EXTRAS_REPO \
|
|
|
|
+ && git -C $WORKSPACE/o3de-extras checkout $O3DE_EXTRAS_BRANCH \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/o3de-extras/Gems/ROS2 \
|
|
|
|
+ && git clone $ROSCON_DEMO_REPO \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo checkout $ROSCON_DEMO_BRANCH \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs install \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs pull \
|
|
|
|
+ && $WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/ROSConDemo/Project \
|
|
|
|
+ && . /opt/ros/humble/setup.sh \
|
|
|
|
+ && cd $WORKSPACE/ROSConDemo/Project \
|
|
|
|
+ && cmake -B $WORKSPACE/ROSConDemo/Project/build/linux -S . -G "Ninja Multi-Config" -DLY_DISABLE_TEST_MODULES=ON -DLY_STRIP_DEBUG_SYMBOLS=ON \
|
|
|
|
+ && cmake --build $WORKSPACE/ROSConDemo/Project/build/linux --config profile --target ROSConDemo.GameLauncher ROSConDemo.Assets -j $CMAKE_JOBS \
|
|
|
|
+ && cd $WORKSPACE/ROSConDemo/kraken_nav \
|
|
|
|
+ && colcon build --symlink-install \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de-extras/ \
|
|
|
|
+ && rm -rf ~/.o3de/3rdParty/ \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/.git \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/AutomatedTesting \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/python/downloaded_packages \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/Code \
|
|
|
|
+ && rm -rf $WORKSPACE/o3de/Gems \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/.git \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/Gem \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/Source \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/Levels \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/ReflectionProbes \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/Azcg/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/CMake \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/CMakeFiles/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/External/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/Testing/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/_deps/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/cmake \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/lib/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/o3de/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/packages/ \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/*.Editor.so \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/EditorPlugins \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/Editor \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/AssetProcessor \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/AssetProcessorBatch \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/MaterialEditor \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/AssetBuilder \
|
|
|
|
+ && rm -rf $WORKSPACE/ROSConDemo/build/linux/bin/profile/MaterialCanvas; \
|
|
|
|
+ elif [ "${IMAGE_TYPE}" = "navstack" ]; then \
|
|
|
|
+ git clone $ROSCON_DEMO_REPO \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo checkout $ROSCON_DEMO_BRANCH \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs install \
|
|
|
|
+ && git -C $WORKSPACE/ROSConDemo lfs pull \
|
|
|
|
+ && cd $WORKSPACE/ROSConDemo/kraken_nav \
|
|
|
|
+ && colcon build --symlink-install; \
|
|
|
|
+ else \
|
|
|
|
+ echo "Unsupported IMAGE_TYPE: ${IMAGE_TYPE}" && exit 1; \
|
|
|
|
+ fi
|
|
|
|
|
|
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
|
|
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
|
|
|
|
+
|
|
|
|
+# Add the appropriate ros2 environment setup script to the system startup
|
|
|
|
+RUN echo "[Unit]" > /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "After=network.target" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "[Service]" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && if [ "${ROS_VERSION}" = "humble" ]; then \
|
|
|
|
+ echo "ExecStart=/opt/ros/humble/setup.bash" >> /etc/systemd/system/setup_ros.service; \
|
|
|
|
+ elif [ "${ROS_VERSION}" = "galactic" ]; then \
|
|
|
|
+ echo "ExecStart=/opt/ros/galactic/setup.bash" >> /etc/systemd/system/setup_ros.service; \
|
|
|
|
+ fi \
|
|
|
|
+ && echo "" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "[Install]" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "WantedBy=default.target" >> /etc/systemd/system/setup_ros.service \
|
|
|
|
+ && echo "" >> /etc/systemd/system/setup_ros.service
|
|
|
|
+
|
|
|
|
+ENV NVIDIA_VISIBLE_DEVICES all
|
|
|
|
+ENV NVIDIA_DRIVER_CAPABILITIES all
|