Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ server*.cfg
_savebackup/
*.swatches
/imgui.ini
backtrace.log
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ When creating a pull request to this repository, make sure that:

### Additional information

We recommend you to read [O3DE contribution guide](https://github.com/o3de/community/blob/main/CONTRIBUTING.md) and [ROS contribution guide](https://docs.ros.org/en/humble/Contributing.html) as well.
We recommend you to read [O3DE contribution guide](https://github.com/o3de/community/blob/main/CONTRIBUTING.md) and [ROS contribution guide](https://docs.ros.org/en/jazzy/Contributing.html) as well.
193 changes: 94 additions & 99 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,141 +2,136 @@
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#

# Collect the arguments for the base ros image
ARG ROS_VERSION=humble
ARG UBUNTU_VERSION=jammy
ARG ROS_VERSION=jazzy
ARG UBUNTU_VERSION=noble

FROM ros:${ROS_VERSION}-ros-base-${UBUNTU_VERSION}

ARG ROS_VERSION
ARG UBUNTU_VERSION


# Argument to determining the image type ('simulation' or 'navstack')
ARG IMAGE_TYPE=simulation # Default to 'simulation'

# Arguments for the source repos needed for the robot vacuum sample docker
ARG O3DE_REPO=https://github.com/o3de/o3de.git
ARG O3DE_BRANCH=2310.1
ARG IMAGE_TYPE=simulation

ARG O3DE_EXTRAS_REPO=https://github.com/o3de/o3de-extras.git
ARG O3DE_EXTRAS_BRANCH=2310.1
# O3DE SDK installer URL and install path
ARG O3DE_DEB_URL=https://o3debinaries.org/stabilization-26050/Latest/Linux/o3de_latest.deb
ARG O3DE_INSTALL_DIR=/opt/O3DE/26.05

ARG LOFT_GEM_REPO=https://github.com/o3de/loft-arch-vis-sample.git
ARG LOFT_GEM_BRANCH=main

ARG ROBOT_VAC_SAMPLE_REPO=https://github.com/o3de/RobotVacuumSample.git
ARG ROBOT_VAC_SAMPLE_BRANCH=main

# Additional argument to control build concurrency
ARG CMAKE_JOBS=8

ENV WORKSPACE=/data/workspace

WORKDIR $WORKSPACE

RUN apt-get update && apt-get upgrade -y

# Add additional package repositories needed for packages
RUN apt-get install -y --no-install-recommends gpg wget curl


# For ubuntu 20.04 (focal) then default version of cmake is not supported. Update and get version 3.24.1 from kitware
RUN if [ "${UBUNTU_VERSION}" = "focal" ]; then \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | \
tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
&& echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | \
tee /etc/apt/sources.list.d/kitware.list >/dev/null \
&& apt-get update; \
RUN apt-get install -y --no-install-recommends wget curl

# Install build tools, O3DE system dependencies, and ROS 2 navigation packages
RUN apt-get install -y --no-install-recommends \
git \
git-lfs \
clang \
ninja-build \
cmake \
libglu1-mesa-dev \
libxcb-xinerama0 \
libxcb-xinput0 \
libxcb-xinput-dev \
libxcb-xfixes0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
libfontconfig1-dev \
libcurl4-openssl-dev \
libsdl2-dev \
zlib1g-dev \
mesa-common-dev \
libssl-dev \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-randr0 \
ufw \
ros-${ROS_DISTRO}-desktop \
ros-${ROS_DISTRO}-slam-toolbox \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-pointcloud-to-laserscan \
ros-${ROS_DISTRO}-gazebo-msgs \
ros-${ROS_DISTRO}-ackermann-msgs \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
ros-${ROS_DISTRO}-control-toolbox \
ros-${ROS_DISTRO}-vision-msgs \
ros-${ROS_DISTRO}-nav-msgs

# Download and install the O3DE SDK
RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
wget -O /tmp/o3de_latest.deb ${O3DE_DEB_URL} && \
apt-get install -y /tmp/o3de_latest.deb && \
rm /tmp/o3de_latest.deb; \
fi

#
# Install packages needed for cloning and building from the source repos
#
# Initialize O3DE Python environment, register the engine, and download required Gems
RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
${O3DE_INSTALL_DIR}/python/get_python.sh && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh register --this-engine && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh register --repo-uri https://canonical.o3de.org && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh download --gem-name LevelGeoreferencing && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh download --gem-name ROS2 && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh download --gem-name ROS2Controllers && \
${O3DE_INSTALL_DIR}/scripts/o3de.sh download --gem-name ROS2Sensors; \
fi

# Install the git and build tools
RUN apt-get install -y --no-install-recommends git \
git-lfs \
clang-12 \
ninja-build \
cmake \
libglu1-mesa-dev \
libxcb-xinerama0 \
libxcb-xinput0 \
libxcb-xinput-dev \
libxcb-xfixes0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
libfontconfig1-dev \
libcurl4-openssl-dev \
libsdl2-dev \
zlib1g-dev \
mesa-common-dev \
libssl-dev libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-randr0 \
libnvidia-gl-470 \
ufw \
ros-${ROS_DISTRO}-slam-toolbox \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-pointcloud-to-laserscan \
ros-${ROS_DISTRO}-gazebo-msgs \
ros-${ROS_DISTRO}-ackermann-msgs \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
ros-${ROS_DISTRO}-control-toolbox \
ros-${ROS_DISTRO}-nav-msgs

COPY cleanup.bash /data/workspace/cleanup.bash

# Clone O3DE repos, register, build, and cleanup in the same layer to reduce the size
# Clone and register the Loft Scene Gem
RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
apt-get install -y --no-install-recommends ros-${ROS_DISTRO}-desktop && \
cd $WORKSPACE && \
git clone $O3DE_REPO && \
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 $LOFT_GEM_REPO && \
git -C $WORKSPACE/loft-arch-vis-sample checkout $LOFT_GEM_BRANCH &&\
git clone ${LOFT_GEM_REPO} --depth 1 -b ${LOFT_GEM_BRANCH} $WORKSPACE/loft-arch-vis-sample && \
git -C $WORKSPACE/loft-arch-vis-sample lfs install && \
git -C $WORKSPACE/loft-arch-vis-sample lfs pull && \
$WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/loft-arch-vis-sample/Gems/ArchVis/ && \
git clone $ROBOT_VAC_SAMPLE_REPO && \
git -C $WORKSPACE/RobotVacuumSample checkout $ROBOT_VAC_SAMPLE_BRANCH &&\
${O3DE_INSTALL_DIR}/scripts/o3de.sh register -gp $WORKSPACE/loft-arch-vis-sample/Gems/ArchVis; \
fi

# Clone and register the Robot Vacuum Sample project
RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
git clone ${ROBOT_VAC_SAMPLE_REPO} --depth 1 -b ${ROBOT_VAC_SAMPLE_BRANCH} $WORKSPACE/RobotVacuumSample && \
git -C $WORKSPACE/RobotVacuumSample lfs install && \
git -C $WORKSPACE/RobotVacuumSample lfs pull && \
$WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/RobotVacuumSample/ && \
. /opt/ros/${ROS_VERSION}/setup.sh && \
cmake -B $WORKSPACE/RobotVacuumSample/build/linux -S $WORKSPACE/RobotVacuumSample -G "Ninja Multi-Config" -DLY_STRIP_DEBUG_SYMBOLS=TRUE -DLY_DISABLE_TEST_MODULES=ON && \
cmake --build $WORKSPACE/RobotVacuumSample/build/linux --config profile --target AssetProcessorBatch RobotVacuumSample.GameLauncher RobotVacuumSample.Assets -j $CMAKE_JOBS && \
$WORKSPACE/cleanup.bash; \
elif [ "${IMAGE_TYPE}" = "navstack" ]; then \
apt-get install -y --no-install-recommends ros-${ROS_DISTRO}-desktop && \
cd $WORKSPACE && \
git clone --recursive $ROBOT_VAC_SAMPLE_REPO && \
git -C $WORKSPACE/RobotVacuumSample checkout $ROBOT_VAC_SAMPLE_BRANCH; \
${O3DE_INSTALL_DIR}/scripts/o3de.sh register -pp $WORKSPACE/RobotVacuumSample; \
elif [ "${IMAGE_TYPE}" = "navstack" ]; then \
git clone --depth 1 -b ${ROBOT_VAC_SAMPLE_BRANCH} ${ROBOT_VAC_SAMPLE_REPO} $WORKSPACE/RobotVacuumSample; \
else \
echo "Unsupported IMAGE_TYPE: ${IMAGE_TYPE}" && exit 1; \
fi
RUN apt-get install -y --no-install-recommends

# Build the project
RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
. /opt/ros/${ROS_DISTRO}/setup.sh && \
cmake -B $WORKSPACE/RobotVacuumSample/build/linux \
-S $WORKSPACE/RobotVacuumSample \
-G "Ninja Multi-Config" \
-DLY_STRIP_DEBUG_SYMBOLS=TRUE \
-DLY_DISABLE_TEST_MODULES=ON && \
cmake --build $WORKSPACE/RobotVacuumSample/build/linux \
--config profile \
--target RobotVacuumSample RobotVacuumSample.GameLauncher RobotVacuumSample.Assets; \
fi

# Remove source files of Loft scene to reduce image size
RUN rm -rf $WORKSPACE/loft-arch-vis-sample

COPY LaunchSimulation.bash /data/workspace/LaunchSimulation.bash
COPY LaunchNavStack.bash /data/workspace/LaunchNavStack.bash

ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV LAUNCH_FULLSCREEN_OPT=0
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=all

ENTRYPOINT ["/bin/bash", "-c"]
Loading