Skip to content

Commit a25e866

Browse files
committed
feat(docker): single-container demo on ubuntu+pixi base, GPU+NPU
Refactor the Docker setup to a single runnable demo container whose entrypoint is `pixi run demo` — the whole single-pc stack (sim, ROS 2, local inference, agents, HMI) in one image, mirroring the native demo. - Layered, cacheable build: ros2 -> o3de -> demo (separately taggable bases). - Base is ubuntu:24.04, not ros:jazzy-ros-core: RoboStack provides ROS 2 via pixi, so the container is pure-pixi (no /opt/ros mixing). - Dockerfile.demo (new): agents app + llama.cpp (Vulkan) + FastFlowLM fork; installs tmux, the lemonade-PPA XRT deps, rustup (tokenizers-cpp) and libfftw3-dev (flm link). WITH_NPU build arg gates the NPU build (default 1; WITH_NPU=0 for GPU-only). - compose.yaml: one demo service with /dev/accel/accel0 + /dev/dri + /dev/kfd, unlimited memlock (NPU), X11, repo-relative model mount + FLM_MODEL_PATH so NPU weights stay under models/ (no host-home coupling), host networking. - Dockerfile.o3de: refresh apt lists before install-o3de (ros2 base strips them). - demo.sh: AMM_KEEP_ALIVE holds PID 1 open (attach to tmux on a TTY, else block) so the container outlives demo.sh's launch. - Drop obsolete Dockerfile.agents, Dockerfile.llama, start_sim.sh. - docs: rewrite quickstart for the local GPU+NPU container flow; fix setup.md cross-reference. Verified: docker compose build is green end-to-end and the demo runs (NPU incl.).
1 parent b368e43 commit a25e866

10 files changed

Lines changed: 251 additions & 241 deletions

File tree

docker/Dockerfile.agents

Lines changed: 0 additions & 15 deletions
This file was deleted.

docker/Dockerfile.demo

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Single-PC demo image: the O3DE+ROS 2 base (sim already built) plus the Python
2+
# agent app and the local inference engines. `pixi run demo` brings the whole
3+
# stack up in tmux, exactly as on a developer's single-pc machine.
4+
#
5+
# base_image = the `o3de` compose service (FROM ros2 -> sim + ROS 2 workspace
6+
# built, full pixi env already solved). See docker/compose.yaml.
7+
FROM base_image
8+
9+
WORKDIR /root/MobileManipulatorDemo
10+
ENV DEMO_ROOT=/root/MobileManipulatorDemo
11+
12+
# Build target. WITH_NPU=1 (default) is the single-pc-gpu-and-npu setup: it builds
13+
# the FastFlowLM fork for the NPU endpoints. WITH_NPU=0 is GPU-only — llama.cpp
14+
# (Vulkan) alone — skipping the NPU apt deps and the FastFlowLM compile.
15+
ARG WITH_NPU=1
16+
17+
# tmux is always required: demo.sh runs each component in its own tmux session.
18+
RUN apt-get update && apt-get install -y --no-install-recommends tmux \
19+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
20+
21+
# NPU build deps (WITH_NPU=1 only). FastFlowLM links the host XRT/NPU libs with
22+
# the system gcc, not pixi's conda toolchain (see build_fastflowlm.sh): XRT dev
23+
# headers + the NPU userspace runtime come from the lemonade PPA. The amdxdna
24+
# *kernel* driver stays on the host; the NPU enters via /dev/accel/accel0.
25+
RUN if [ "$WITH_NPU" = "1" ]; then \
26+
apt-get update && apt-get install -y --no-install-recommends \
27+
software-properties-common gnupg \
28+
&& add-apt-repository -y ppa:lemonade-team/stable \
29+
&& apt-get update && apt-get install -y --no-install-recommends \
30+
build-essential \
31+
libxrt-dev libxrt-npu2 \
32+
libavformat-dev libavutil-dev libavcodec-dev \
33+
libswresample-dev libswscale-dev \
34+
libfftw3-dev \
35+
uuid-dev libdrm-dev \
36+
&& apt-get clean && rm -rf /var/lib/apt/lists/* ; \
37+
fi
38+
39+
# Python agent app + inference SSOT + RAG corpus + monitoring. Refresh pixi
40+
# manifests and scripts/ too so this layer's `pixi run` tasks (e.g. the renamed
41+
# init-submodules) and runtime helpers (demo.sh, ...) match this checkout rather
42+
# than the snapshot baked into the o3de base.
43+
COPY pixi.toml pixi.lock ./
44+
COPY pyproject.toml uv.lock ./
45+
COPY config.toml ./
46+
COPY .gitmodules ./
47+
COPY rai_app/ rai_app/
48+
COPY regulations_db/ regulations_db/
49+
COPY monitoring/ monitoring/
50+
COPY scripts/ scripts/
51+
RUN pixi run sync
52+
53+
# Local inference engines built from the pinned submodules. llama.cpp (Vulkan,
54+
# gpu/cpu endpoints) is always built; init-submodules needs .git (inherited from
55+
# the o3de base) + .gitmodules (copied above).
56+
RUN pixi run init-submodules && pixi run build-llama
57+
58+
# FastFlowLM (npu endpoints), WITH_NPU=1 only. Its tokenizers-cpp vendors a Rust
59+
# static lib (libtokenizers_c.a), so the build needs cargo. Install via rustup
60+
# (latest stable — Ubuntu's apt cargo can be too old for the pinned crate) and
61+
# source it so cmake's find_program(cargo) succeeds at configure time.
62+
RUN if [ "$WITH_NPU" = "1" ]; then \
63+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal \
64+
&& . "$HOME/.cargo/env" \
65+
&& pixi run build-fastflowlm ; \
66+
fi
67+
68+
# Brings up sim -> stack -> inference -> agents -> hmi, one tmux session each.
69+
# AMM_KEEP_ALIVE (set in compose) holds this process open so the container — and
70+
# the detached tmux sessions it owns — stay alive after demo.sh finishes launching.
71+
ENTRYPOINT ["pixi", "run", "demo"]

docker/Dockerfile.llama

Lines changed: 0 additions & 5 deletions
This file was deleted.

docker/Dockerfile.o3de

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM base_image
22

3-
# Install O3DE build dependencies and the 26.05 SDK
4-
# Note: git, git-lfs, ninja-build, ros-dev-tools, pixi are inherited from base image
3+
# Install O3DE build dependencies and the 26.05 SDK.
4+
# Note: git, git-lfs, pixi are inherited from the base image; ROS/colcon/cmake/
5+
# ninja come from the conda env. clang is O3DE's compiler, hence apt here.
56
RUN apt update && apt install -y \
67
cmake \
78
libstdc++-12-dev \
@@ -37,8 +38,11 @@ COPY .git .git/
3738
COPY project_gems/ project_gems/
3839
COPY sim/ sim/
3940

40-
RUN pixi run install-o3de
41-
RUN apt install -y git-lfs && git lfs install --force
41+
# install_o3de.sh apt-installs the SDK's system deps (ninja-build, pkg-config,
42+
# ...) without running `apt-get update` itself, so refresh the lists here — the
43+
# ros2 base strips them to stay small.
44+
RUN apt-get update && pixi run install-o3de && apt-get clean && rm -rf /var/lib/apt/lists/*
45+
RUN git lfs install --force
4246
RUN pixi run build-sim
4347

4448
WORKDIR /root/MobileManipulatorDemo

docker/Dockerfile.ros2

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
FROM ros:jazzy-ros-core
2-
3-
RUN apt update && apt install -y --no-install-recommends \
4-
curl \
5-
python3-vcstool \
6-
git \
7-
git-lfs \
8-
ninja-build \
9-
ros-dev-tools \
10-
lsb-release \
11-
wget \
12-
gnupg
13-
14-
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
15-
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
16-
RUN apt update
17-
RUN apt install -y libgz-math7-dev
1+
# RoboStack ships the entire ROS 2 Jazzy runtime through pixi, so the base is
2+
# plain Ubuntu — NOT ros:jazzy-ros-core. Mixing apt ROS (/opt/ros) with conda
3+
# RoboStack is exactly what scripts/check_env.sh forbids; an Ubuntu base keeps the
4+
# container a pure-pixi environment, identical to a native checkout.
5+
FROM ubuntu:24.04
6+
7+
# colcon/ROS want a UTF-8 locale; C.UTF-8 ships with glibc (no `locales` package).
8+
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive
9+
10+
# Only host-level tooling pixi can't bootstrap itself: the pixi installer plus
11+
# git/LFS for `vcs import` and submodules. Compilers, colcon, vcstool, cmake and
12+
# ninja all come from the conda env (see pixi.toml). gz-math is the one system
13+
# build dep some ros2_ws source packages link against, from the OSRF apt repo.
14+
RUN apt-get update && apt-get install -y --no-install-recommends \
15+
ca-certificates \
16+
curl \
17+
wget \
18+
git \
19+
git-lfs \
20+
gnupg \
21+
lsb-release \
22+
&& wget -qO /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg https://packages.osrfoundation.org/gazebo.gpg \
23+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list \
24+
&& apt-get update && apt-get install -y --no-install-recommends \
25+
libgz-math7-dev \
26+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
1827

1928
RUN curl -fsSL https://pixi.sh/install.sh | PIXI_HOME=/usr/local bash
2029

0 commit comments

Comments
 (0)