浏览代码

Initial docker commit for ubuntu 20.04

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 2 年之前
父节点
当前提交
07b2f7e892
共有 5 个文件被更改,包括 261 次插入0 次删除
  1. 137 0
      Docker/Dockerfile.ubuntu-20.04
  2. 20 0
      Docker/LaunchClient.bash.ubuntu-20.04
  3. 16 0
      Docker/LaunchRViz.bash.ubuntu-20.04
  4. 36 0
      Docker/README.md
  5. 52 0
      Docker/delete_source.bash

+ 137 - 0
Docker/Dockerfile.ubuntu-20.04

@@ -0,0 +1,137 @@
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+
+# Example usage:
+#
+# sudo DOCKER_BUILDKIT=1 docker build -t o3de_loft_demo:latest -f Dockerfile.ubuntu-20.04 .
+#
+
+FROM ros:galactic-ros-base-focal
+ARG minimal
+ENV WORKSPACE=/data/workspace
+ENV O3DE_REPO=https://github.com/o3de/o3de.git
+ENV ROS2_GEM_REPO=https://github.com/RobotecAI/o3de-ros2-gem.git
+ENV LOFT_GEM_REPO=https://github.com/o3de/loft-arch-vis-sample.git
+ENV O3DE_DEMO_REPO=https://github.com/RobotecAI/o3de-demo-project.git
+
+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
+
+RUN 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
+
+RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
+    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
+    /bin/bash -c 'source /etc/os-release && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null'
+
+RUN apt-get update
+
+#
+# Install packages needed for cloning and building from the source repos
+#
+
+# Install the git and build tools
+RUN apt-get install -y --no-install-recommends git \
+                       git-lfs \
+                       cmake=3.24.1-0kitware1ubuntu20.04.1 \
+                       clang-12 \
+                       ninja-build
+
+# Install the O3DE-specific required packages
+RUN apt-get install -y --no-install-recommends 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
+
+# Clone O3DE repo and register the engine
+RUN cd $WORKSPACE && \
+    git clone --single-branch --recursive --branch development $O3DE_REPO && \
+    cd o3de && \
+    git lfs install && \
+    git lfs pull
+
+RUN cd $WORKSPACE/o3de && \
+    python/get_python.sh
+RUN cd $WORKSPACE/o3de && \
+    $WORKSPACE/o3de/scripts/o3de.sh register --this-engine
+
+
+# Clone the ROS2 Gem and register it
+RUN cd $WORKSPACE && \
+    git clone $ROS2_GEM_REPO --single-branch --branch development && \
+    $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/o3de-ros2-gem
+
+# Add additional ROS2/Galactic packages
+RUN /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
+                  apt install -y 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}-control-toolbox'
+
+# Clone the loft scene and register the ArchVis Gem
+RUN cd $WORKSPACE && \
+    git clone --single-branch --recursive $LOFT_GEM_REPO && \
+    cd loft-arch-vis-sample && \
+    git lfs install && \
+    git lfs pull && \
+    $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/loft-arch-vis-sample/Gems/ArchVis/
+
+
+# Clone the demo project and register the project
+RUN cd $WORKSPACE && \
+    git clone --single-branch --branch main --recursive $O3DE_DEMO_REPO && \
+    cd o3de-demo-project && \
+    git lfs install && \
+    git lfs pull && \
+    $WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/o3de-demo-project/ 
+
+
+# Configure the project
+RUN cd $WORKSPACE/o3de-demo-project && \
+    /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
+                  cmake -B build/linux -S . -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=profile -DLY_STRIP_DEBUG_SYMBOLS=TRUE -DLY_DISABLE_TEST_MODULES=ON'
+
+# Build the project
+RUN cd $WORKSPACE/o3de-demo-project && \
+    /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
+                  cmake --build build/linux --config profile --target AssetProcessorBatch ROS2-Gem-Demo.GameLauncher ROS2-Gem-Demo.Assets -j 12'
+
+
+COPY LaunchClient.bash.ubuntu-20.04 /data/workspace/LaunchClient.bash
+COPY LaunchRViz.bash.ubuntu-20.04 /data/workspace/LaunchRViz.bash
+COPY delete_source.bash /data/workspace/delete_source.bash
+
+RUN if [ "$minimal" -eq "1" ]; then /bin/bash -c 'source /data/workspace/delete_source.bash'; else echo "Skipping source delete"; fi
+ 
+ENV NVIDIA_VISIBLE_DEVICES all
+ENV NVIDIA_DRIVER_CAPABILITIES all
+ 
+ENTRYPOINT ["/bin/bash", "-c"]

+ 20 - 0
Docker/LaunchClient.bash.ubuntu-20.04

@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+unset LD_LIBRARY_PATH
+
+source /opt/ros/galactic/setup.bash
+
+export LD_LIBRARY_PATH=/data/workspace/o3de-demo-project/build/linux/bin/profile:$LD_LIBRARY_PATH
+
+cd /data/workspace/o3de-demo-project/build/linux/bin/profile
+
+./ROS2-Gem-Demo.GameLauncher -bg_ConnectToAssetProcessor=0
+
+
+

+ 16 - 0
Docker/LaunchRViz.bash.ubuntu-20.04

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+unset LD_LIBRARY_PATH
+
+source /opt/ros/galactic/setup.bash
+
+cd /data/workspace/o3de-demo-project/launch
+
+ros2 launch navigation.launch.py
+

+ 36 - 0
Docker/README.md

@@ -0,0 +1,36 @@
+# Docker scripts for running the O3DE Demo Project
+
+The following Dockerfiles defined in this path will prepare the appropiate
+ROS2 package (Ubuntu 20.04/Focal + Galactic or Ubuntu 22.04/Jammy + Humble)
+based environment and build the components necessary to run the O3DE demo
+project simulator through the O3DE engine.
+
+## Prerequisites
+
+* [Hardware requirements of o3de](https://www.o3de.org/docs/welcome-guide/requirements/)
+* At least 120 GB of free disk space
+* Docker installed and configured
+* SUDO Access
+
+## Building the Docker Image
+
+There are two Dockerfile images defined
+
+* Dockerfile.ubuntu-20.04 (Focal / Galactic)
+* Dockerfile.ubuntu-22.04 (Jammy / Humble)
+
+Select which docker image you would like to build and run the following command
+
+```
+sudo docker build --build-arg minimal=1  -t o3de_loft_demo:latest -f Dockerfile.ubuntu-20.04 .
+```
+
+```
+sudo docker build --build-arg minimal=1  -t o3de_loft_demo:latest -f Dockerfile.ubuntu-22.04 .
+```
+
+## Running the Docker Image
+
+
+
+

+ 52 - 0
Docker/delete_source.bash

@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+#
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+
+# Delete files that were only needed for the Client and AssetProcessing after a build of the code and assets are complete
+
+DELETE_LIST=(o3de-ros2-gem/ \
+             loft-arch-vis-sample/ \
+             o3de/.git \
+             o3de/AutomatedTesting \
+             o3de/python/downloaded_packages \
+             o3de/Code \
+             o3de/Gems \
+             o3de-demo-project/.git \
+             o3de-demo-project/Gem \
+             o3de-demo-project/Source \
+             o3de-demo-project/Levels \
+             o3de-demo-project/ReflectionProbes \
+             o3de-demo-project/build/linux/Azcg/ \
+             o3de-demo-project/build/linux/CMake \
+             o3de-demo-project/build/linux/CMakeFiles/ \
+             o3de-demo-project/build/linux/External/ \
+             o3de-demo-project/build/linux/Testing/ \
+             o3de-demo-project/build/linux/_deps/ \
+             o3de-demo-project/build/linux/cmake \
+             o3de-demo-project/build/linux/lib/ \
+             o3de-demo-project/build/linux/o3de/ \
+             o3de-demo-project/build/linux/packages/ \
+             o3de-demo-project/build/linux/runtime_dependencies/ \
+             ~/.o3de/3rdParty/ \
+             ~/.o3de/3rdParty/packages/ \
+             o3de-demo-project/build/linux/bin/profile/*.Editor.so \
+             o3de-demo-project/build/linux/bin/profile/EditorPlugins \
+             o3de-demo-project/build/linux/bin/profile/Editor \
+             o3de-demo-project/build/linux/bin/profile/AssetProcessor \
+             o3de-demo-project/build/linux/bin/profile/AssetProcessorBatch \
+             o3de-demo-project/build/linux/bin/profile/MaterialEditor \
+             o3de-demo-project/build/linux/bin/profile/AssetBuilder \
+             o3de-demo-project/build/linux/bin/profile/MaterialCanvas )
+
+for i in ${DELETE_LIST[@]}
+do
+   echo "Deleting /data/workspace/$i"
+   rm -rf $i
+done
+
+exit 0
+