Jelajahi Sumber

Merge pull request #11 from spham-amzn/spham_amzn/update_docker_and_readme

Updates to Docker and Readme for RobotVacuum sample
Steve Pham 2 tahun lalu
induk
melakukan
cf1b4c9074
2 mengubah file dengan 18 tambahan dan 10 penghapusan
  1. 8 7
      Docker/Dockerfile
  2. 10 3
      Docker/README.md

+ 8 - 7
Docker/Dockerfile

@@ -17,14 +17,12 @@ 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=development
 
-ARG ROS2_GEM_REPO=https://github.com/o3de/o3de-extras.git
-ARG ROS2_GEM_BRANCH=development
+ARG O3DE_EXTRAS_REPO=https://github.com/o3de/o3de-extras.git
+ARG O3DE_EXTRAS_BRANCH=development
 
 ARG LOFT_GEM_REPO=https://github.com/o3de/loft-arch-vis-sample.git
 ARG LOFT_GEM_BRANCH=main
@@ -32,6 +30,9 @@ 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
@@ -104,8 +105,8 @@ RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
         git -C $WORKSPACE/o3de lfs pull && \
         $WORKSPACE/o3de/python/get_python.sh && \
         $WORKSPACE/o3de/scripts/o3de.sh register -ep $WORKSPACE/o3de && \
-        git clone $ROS2_GEM_REPO && \
-        git -C $WORKSPACE/o3de-extras checkout $ROS2_GEM_BRANCH &&\
+        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 --recursive $LOFT_GEM_REPO && \
         git -C $WORKSPACE/loft-arch-vis-sample checkout $LOFT_GEM_BRANCH &&\
@@ -119,7 +120,7 @@ RUN if [ "${IMAGE_TYPE}" = "simulation" ]; then \
         $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 && \
+        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 && \

+ 10 - 3
Docker/README.md

@@ -20,9 +20,14 @@ on Ubuntu 22.04 (jammy) with the ROS2 Humble distribution. For example, to build
 command:
 
 ```
-docker build -t o3de_robot_vacuum_simulation:latest .
+
+docker build --build-arg O3DE_BRANCH=199205f --build-arg O3DE_EXTRAS_BRANCH=cbd3cd5 --build-arg LOFT_GEM_BRANCH=eed5208 -t o3de_robot_vacuum_simulation:latest .
 ```
 
+**Note** 
+The above command example tags specific commits for o3de, the ros2 gem, and the loft scene asset repos and are based on known working commits. See the Advanced Options section below for more information.
+
+
 This will create a docker image named 'o3de_robot_vacuum_simulation' with the tag 'latest' that contains both the simulation launcher and the 
 navigation stack. It will also contain helper scripts that will launch either the simulation (LaunchSimulation.bash) or 
 the Rviz2 (LaunchNavStack.bash).
@@ -104,7 +109,7 @@ The Dockerscripts use the following arguments to determine the repository to pul
 | Argument              | Repository                       | Default     |
 |-----------------------|----------------------------------|-------------|
 | O3DE_REPO             | O3DE                             | https://github.com/o3de/o3de.git                   |
-| ROS2_GEM_REPO         | O3DE ROS2 Gem                    | https://github.com/o3de/o3de-extras.git            |
+| O3DE_EXTRAS_REPO      | O3DE Extras                      | https://github.com/o3de/o3de-extras.git            |
 | LOFT_GEM_REPO         | Loft ArchVis Sample Scene        | https://github.com/o3de/loft-arch-vis-sample.git   |
 | ROBOT_VAC_SAMPLE_REPO | Loft Scene Simulation repository | https://github.com/o3de/RobotVacuumSample          |
 
@@ -113,7 +118,9 @@ In addition the repositories, the following arguments target the branch, commit,
 | Argument                | Repository                       | Default     |
 |-------------------------|----------------------------------|-------------|
 | O3DE_BRANCH             | O3DE                             | development |
-| ROS2_GEM_BRANCH         | O3DE ROS2 Gem                    | development |
+| O3DE_EXTRAS_BRANCH      | O3DE Extras                      | development |
 | LOFT_GEM_BRANCH         | Loft ArchVis Sample Scene        | main        |
 | ROBOT_VAC_SAMPLE_BRANCH | Loft Scene Simulation repository | main        |
 
+### Optimizing the build process ###
+The docker script provides a cmake-specific argument override to control the number of parallel jobs that can be used during the build of the docker image. ```CMAKE_JOBS``` sets the maximum number of concurrent jobs cmake will run during its build process and defaults to 8 jobs. This number can be adjusted to better suit the hardware which is running the docker image build.