Browse Source

Add optional arguments to override the default branch to pull from

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 2 năm trước cách đây
mục cha
commit
2185820d94

+ 4 - 1
Docker/Dockerfile.navstack.ubuntu-galactic

@@ -6,6 +6,8 @@
 
 FROM ros:galactic-ros-base-focal
 
+ARG o3de_demo_branch=main
+
 ENV WORKSPACE=/data/workspace
 
 ENV DEBIAN_FRONTEND=noninteractive
@@ -44,7 +46,8 @@ RUN apt-get install -y --no-install-recommends libglu1-mesa-dev \
 
 # Clone the demo project and register the project
 RUN cd $WORKSPACE && \
-    git clone --single-branch --branch main --recursive $O3DE_DEMO_REPO 
+    git clone --recursive $O3DE_DEMO_REPO && \
+    git -C $WORKSPACE/o3de-demo-project checkout $o3de_demo_branch
 
 COPY LaunchNavStack.bash.ubuntu-galactic /data/workspace/LaunchNavStack.bash
 

+ 4 - 1
Docker/Dockerfile.navstack.ubuntu-humble

@@ -6,6 +6,8 @@
 
 FROM ros:humble-ros-base-jammy
 
+ARG o3de_demo_branch=main
+
 ENV WORKSPACE=/data/workspace
 
 ENV DEBIAN_FRONTEND=noninteractive
@@ -46,7 +48,8 @@ RUN apt-get install -y --no-install-recommends libglu1-mesa-dev \
 
 # Clone the demo project and register the project
 RUN cd $WORKSPACE && \
-    git clone --single-branch --branch main --recursive $O3DE_DEMO_REPO 
+    git clone --recursive $O3DE_DEMO_REPO && \
+    git -C $WORKSPACE/o3de-demo-project checkout $o3de_demo_branch
 
 COPY LaunchNavStack.bash.ubuntu-humble /data/workspace/LaunchNavStack.bash
 

+ 14 - 6
Docker/Dockerfile.simulation.ubuntu-galactic

@@ -6,6 +6,11 @@
 
 FROM ros:galactic-ros-base-focal
 
+ARG o3de_branch=development
+ARG ros2_gem_branch=development
+ARG loft_gem_branch=main
+ARG o3de_demo_branch=main
+
 ENV WORKSPACE=/data/workspace
 
 ENV O3DE_REPO=https://github.com/o3de/o3de.git
@@ -13,8 +18,6 @@ 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
 
-ENV ROS2_DISTRO=galactic
-
 WORKDIR $WORKSPACE
 
 COPY LaunchSimulation.bash.ubuntu-galactic /data/workspace/LaunchSimulation.bash
@@ -75,18 +78,22 @@ RUN /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
 
 # Clone O3DE repos, register, build, and cleanup in the same layer to reduce the size
 RUN cd $WORKSPACE && \
-    git clone --single-branch --branch development --recursive $O3DE_REPO && \
+    git clone --recursive $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 --single-branch --branch development $ROS2_GEM_REPO && \
+    git clone $ROS2_GEM_REPO && \
+    git -C $WORKSPACE/o3de-ros2-gem checkout $ros2_gem_branch &&\
     $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/o3de-ros2-gem && \
-    git clone --single-branch --recursive $LOFT_GEM_REPO && \
+    git clone --recursive $LOFT_GEM_REPO && \
+    git -C $WORKSPACE/loft-arch-vis-sample checkout $loft_gem_branch &&\
     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 --single-branch --branch main --recursive $O3DE_DEMO_REPO && \
+    git clone --recursive $O3DE_DEMO_REPO && \
+    git -C $WORKSPACE/o3de-demo-project checkout $o3de_demo_branch &&\
     git -C $WORKSPACE/o3de-demo-project lfs install && \
     git -C $WORKSPACE/o3de-demo-project lfs pull && \
     $WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/o3de-demo-project/  && \
@@ -94,6 +101,7 @@ RUN cd $WORKSPACE && \
                   cmake -B $WORKSPACE/o3de-demo-project/build/linux -S $WORKSPACE/o3de-demo-project -G "Ninja Multi-Config" -DLY_STRIP_DEBUG_SYMBOLS=TRUE -DLY_DISABLE_TEST_MODULES=ON && \
                   cmake --build $WORKSPACE/o3de-demo-project/build/linux --config profile --target AssetProcessorBatch ROS2-Gem-Demo.GameLauncher ROS2-Gem-Demo.Assets && \
                   $WORKSPACE/cleanup.bash'
+
  
 ENV NVIDIA_VISIBLE_DEVICES all
 ENV NVIDIA_DRIVER_CAPABILITIES all

+ 14 - 4
Docker/Dockerfile.simulation.ubuntu-humble

@@ -6,7 +6,13 @@
 
 FROM ros:humble-ros-base-jammy
 
+ARG o3de_branch=development
+ARG ros2_gem_branch=development
+ARG loft_gem_branch=main
+ARG o3de_demo_branch=main
+
 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
@@ -65,18 +71,22 @@ RUN /bin/bash -c 'source /opt/ros/humble/setup.bash && \
 
 # Clone O3DE repos, register, build, and cleanup in the same layer to reduce the size
 RUN cd $WORKSPACE && \
-    git clone --single-branch --branch development --recursive $O3DE_REPO && \
+    git clone --recursive $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 --single-branch --branch development $ROS2_GEM_REPO && \
+    git clone $ROS2_GEM_REPO && \
+    git -C $WORKSPACE/o3de-ros2-gem checkout $ros2_gem_branch &&\
     $WORKSPACE/o3de/scripts/o3de.sh register -gp $WORKSPACE/o3de-ros2-gem && \
-    git clone --single-branch --recursive $LOFT_GEM_REPO && \
+    git clone --recursive $LOFT_GEM_REPO && \
+    git -C $WORKSPACE/loft-arch-vis-sample checkout $loft_gem_branch &&\
     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 --single-branch --branch main --recursive $O3DE_DEMO_REPO && \
+    git clone --recursive $O3DE_DEMO_REPO && \
+    git -C $WORKSPACE/o3de-demo-project checkout $o3de_demo_branch &&\
     git -C $WORKSPACE/o3de-demo-project lfs install && \
     git -C $WORKSPACE/o3de-demo-project lfs pull && \
     $WORKSPACE/o3de/scripts/o3de.sh register -pp $WORKSPACE/o3de-demo-project/  && \

+ 18 - 0
Docker/README.md

@@ -90,3 +90,21 @@ Once the simulation is up and running, launch the robot application docker image
 ```
 rocker --x11 --nvidia o3de_loft_demo_simulation:latest /data/workspace/LaunchNavStack.bash
 ```
+
+### Advanced Options
+
+The Dockerscripts as written are designed to pull from the latest branches of the following github repos:
+
+[O3DE main repository](https://github.com/o3de/o3de.git)  (development)
+[O3DE ROS2 Gem repository](https://github.com/RobotecAI/o3de-ros2-gem.git) (development)
+[O3DE Loft ArchVis Sample Scene repository](https://github.com/o3de/loft-arch-vis-sample.git) (main)
+[Loft Scene Simulation repository](https://github.com/RobotecAI/o3de-demo-project.git) (main)
+
+The following build arguments are supported to pull from alternative branches, tags, or commits:
+
+| Argument         | Repository                       | Default     |
+|------------------|----------------------------------|-------------|
+| o3de_branch      | O3DE                             | development |
+| ros2_gem_branch  | O3DE ROS2 Gem                    | development |
+| loft_gem_branch  | Loft ArchVis Sample Scene        | main        |
+| o3de_demo_branch | Loft Scene Simulation repository | main        |