Skip to content

feat: mani demo docker#748

Open
jmatejcz wants to merge 11 commits intomainfrom
jm/feat/mani-demo-docker
Open

feat: mani demo docker#748
jmatejcz wants to merge 11 commits intomainfrom
jm/feat/mani-demo-docker

Conversation

@jmatejcz
Copy link
Contributor

@jmatejcz jmatejcz commented Jan 5, 2026

Purpose

Update base dockerfile
Add dockerfile for manipulation demo

Proposed Changes

  • Base Dockerfile is slightly refactored adding some env variables that make logs cleaner. It also now uses caches to speed up following builds.
  • Add Manipulation demo dockerfile which runs whole demo
  • Added back script that downloads weights, so that user do not wait couple mins with waiting for services.... (not sure about this though)
  • Changed commands to run. Docker no longer shares network with host, which led to bugs when 2 containers were run in the same network

Issues

  • Links to relevant issues

Testing

Run manipulation demo in docker following the docs

Summary by CodeRabbit

  • New Features

    • Added manipulation demo Docker container with web interface access at localhost:8501
  • Documentation

    • Simplified Docker setup instructions for core environment
    • Updated manipulation demo setup guide with streamlined deployment steps
  • Chores

    • Enhanced Docker images with improved build caching and environment optimization

@jmatejcz jmatejcz force-pushed the jm/feat/mani-demo-docker branch from b84bba5 to 863235e Compare January 5, 2026 14:49
@jmatejcz jmatejcz force-pushed the jm/mani-docker-demo branch from 414c328 to 099f22d Compare January 12, 2026 11:02
Base automatically changed from jm/mani-docker-demo to main January 13, 2026 09:41
@jmatejcz jmatejcz force-pushed the jm/feat/mani-demo-docker branch 2 times, most recently from c76cb53 to 170f897 Compare January 13, 2026 14:10
@jmatejcz jmatejcz force-pushed the jm/feat/mani-demo-docker branch from 170f897 to 34de7b3 Compare January 14, 2026 10:36
@jmatejcz jmatejcz marked this pull request as ready for review January 14, 2026 10:53
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.11%. Comparing base (65b80ba) to head (34de7b3).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #748      +/-   ##
==========================================
+ Coverage   65.33%   69.11%   +3.78%     
==========================================
  Files          78       82       +4     
  Lines        3392     3681     +289     
==========================================
+ Hits         2216     2544     +328     
+ Misses       1176     1137      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmatejcz
Copy link
Contributor Author

jmatejcz commented Feb 3, 2026

@CodeRabbit

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Tip

For best results, initiate chat on the files or code changes.

@jmatejcz Hello! How can I help you with this PR? I can:

  • Review the changes in detail
  • Answer questions about the code
  • Help with specific concerns or improvements
  • Generate code or tests
  • Or anything else you need assistance with

Just let me know what you'd like me to do!

@jmatejcz
Copy link
Contributor Author

jmatejcz commented Feb 3, 2026

@CodeRabbit full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

Walkthrough

The PR introduces a new manipulation demo Docker environment alongside supporting documentation and scripts. It adds Fast DDS configuration and Poetry caching optimizations to the main Dockerfile, creates a new manipulation-demo Dockerfile with vcs import and streamlit entrypoint, simplifies demo documentation, and includes a model weights download script.

Changes

Cohort / File(s) Summary
Docker Configuration
docker/Dockerfile, docker/Dockerfile.manipulation-demo
Main Dockerfile adds NVIDIA visibility, Fast DDS environment variables, Poetry caching, and dependency management. New manipulation-demo Dockerfile imports demo repos via vcs, installs dependencies with rosdep and Poetry, builds with colcon, and launches streamlit application.
Documentation
docs/demos/manipulation.md, docs/setup/setup_docker.md
Manipulation demo doc refactors setup steps to emphasize direct docker build and run, removes X11/NVIDIA guidance, and adds web interface access information. Docker setup doc simplifies container run commands by removing host network/IPC/pid sharing options and test execution steps.
Python Scripts
src/rai_extensions/rai_perception/rai_perception/scripts/download_weights.py
New script instantiates GroundingDinoAgent and GroundedSamAgent for model weight downloading during container build.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • boczekbartek
  • Juliaj
  • maciejmajek
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: mani demo docker' is vague and uses abbreviated terminology ('mani' instead of 'manipulation') that doesn't clearly convey the main changes to reviewers. Use a more descriptive title like 'feat: add manipulation demo Docker configuration and base Dockerfile refactoring' to clearly communicate the primary changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description covers all required template sections with clear explanations of purpose, changes, and testing approach, though issue links are not provided.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jm/feat/mani-demo-docker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/demos/manipulation.md`:
- Around line 92-129: Fix typos and unify terminology and image tag in the
manipulation demo steps: correct "manipulaiton" to "manipulation" in the docker
build step (the line containing the docker build command for
rai-manipulation-demo:jazzy), change "environmental variable" to "environment
variable" in the line with export OPENAI_API_KEY (the export OPENAI_API_KEY=...
line), update the docker run example to reference the full image tag
"rai-manipulation-demo:humble" instead of "rai:humble" (the docker run -p
8501... line), and remove the extra space before the colon in the web interface
URL line so it reads "http://localhost:8501".
🧹 Nitpick comments (3)
src/rai_extensions/rai_perception/rai_perception/scripts/download_weights.py (1)

17-21: Ensure agents are stopped even if initialization fails.
If GroundedSamAgent() raises, GroundingDinoAgent never gets stopped. A try/finally avoids resource leaks.

♻️ Proposed fix
 if __name__ == "__main__":
-    agent1 = GroundingDinoAgent()
-    agent2 = GroundedSamAgent()
-    agent1.stop()
-    agent2.stop()
+    agent1 = agent2 = None
+    try:
+        agent1 = GroundingDinoAgent()
+        agent2 = GroundedSamAgent()
+    finally:
+        if agent2:
+            agent2.stop()
+        if agent1:
+            agent1.stop()
docker/Dockerfile.manipulation-demo (1)

34-35: Use exec in ENTRYPOINT to forward signals.
Without exec, Bash stays PID 1 and may not forward SIGTERM cleanly.

♻️ Proposed fix
-ENTRYPOINT ["bash", "-c", ". setup_shell.sh && streamlit run examples/manipulation-demo-streamlit.py \"$@\""]
+ENTRYPOINT ["bash", "-c", ". setup_shell.sh && exec streamlit run examples/manipulation-demo-streamlit.py \"$@\""]
docker/Dockerfile (1)

82-84: Confirm that forcing Fast DDS is intended for all containers.
If other DDS implementations are supported, consider documenting how to override RMW_IMPLEMENTATION at runtime.

Comment on lines +92 to +129
1. Set up docker as outlined in the [docker setup guide](../setup/setup_docker.md).

2. Enable X11 access for the docker container:
2. Build docker manipulaiton demo image:

```shell
xhost +local:root
docker build -t rai-manipulation-demo:jazzy --build-arg ROS_DISTRO=jazzy -f docker/Dockerfile.manipulation-demo .
```

3. Run the docker container with the following command:
3. Enable X11 access for the docker container:

```shell
docker run --net=host --ipc=host --pid=host -e ROS_DOMAIN_ID=$ROS_DOMAIN_ID -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all -it rai:jazzy # or rai:humble
xhost +local:root
```

!!! tip "NVIDIA Container Toolkit"

In order to use the `--gpus all` flag, the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) must be installed on the host machine.

4. (Inside the docker container) By default, RAI uses OpenAI as the vendor. Thus, it is necessary
to set the `$OPENAI_API_KEY` environmental variable. The command below may be utilized to set
the variable and add it to the container's `.bashrc` file:
4. Set the `$OPENAI_API_KEY` environmental variable.

```shell
export OPENAI_API_KEY=YOUR_OPEN_AI_API_KEY
echo "export OPENAI_API_KEY=$OPENAI_API_KEY" >> ~/.bashrc
```

!!! note AI vendor change

The default vendor can be changed to a different provider via the [RAI configuration tool](../setup/install.md#15-configure-rai)

5. After this, follow the steps in the [Local Setup](#local-setup) from step 2 onwards.
5. Run the docker container with the following command:

!!! tip "New terminal in docker"
```shell
docker run -p 8501:8501 -e DISPLAY=$DISPLAY -e OPENAI_API_KEY=$OPENAI_API_KEY -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all -it rai-manipulation-demo:jazzy # or rai:humble
```

!!! tip "NVIDIA Container Toolkit"

In order to open a new terminal in the same docker container, you can use the following command:
In order to use the `--gpus all` flag, the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) must be installed on the host machine.

```shell
docker exec -it <container_id> bash
```
6. To access the demo web interface, open your web browser and navigate to :
```
http://localhost:8501
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, locate and examine the file
cat -n docs/demos/manipulation.md | sed -n '90,130p'

Repository: RobotecAI/rai

Length of output: 1648


Fix typos, terminology, image tag reference, and formatting.

Line 94: "manipulaiton" is a typo. Line 106: use "environment variable" (standard terminology). Line 119: the comment references "rai:humble" but should match the full image tag format "rai-manipulation-demo:humble". Line 126: remove the extra space before the colon.

📝 Proposed fix
-2.  Build docker manipulaiton demo image:
+2.  Build docker manipulation demo image:

-4.  Set the `$OPENAI_API_KEY` environmental variable.
+4.  Set the `$OPENAI_API_KEY` environment variable.

-    docker run -p 8501:8501 -e DISPLAY=$DISPLAY -e OPENAI_API_KEY=$OPENAI_API_KEY -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all -it rai-manipulation-demo:jazzy # or rai:humble
+    docker run -p 8501:8501 -e DISPLAY=$DISPLAY -e OPENAI_API_KEY=$OPENAI_API_KEY -v /tmp/.X11-unix:/tmp/.X11-unix --gpus all -it rai-manipulation-demo:jazzy # or rai-manipulation-demo:humble

-6.  To access the demo web interface, open your web browser and navigate to :
+6.  To access the demo web interface, open your web browser and navigate to:
🤖 Prompt for AI Agents
In `@docs/demos/manipulation.md` around lines 92 - 129, Fix typos and unify
terminology and image tag in the manipulation demo steps: correct "manipulaiton"
to "manipulation" in the docker build step (the line containing the docker build
command for rai-manipulation-demo:jazzy), change "environmental variable" to
"environment variable" in the line with export OPENAI_API_KEY (the export
OPENAI_API_KEY=... line), update the docker run example to reference the full
image tag "rai-manipulation-demo:humble" instead of "rai:humble" (the docker run
-p 8501... line), and remove the extra space before the colon in the web
interface URL line so it reads "http://localhost:8501".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants