Skip to content

Commit f203869

Browse files
Merge pull request #2 from jabasai/copilot/add-docker-compose-and-entrypoint
Add docker-compose.yml and entrypoint.sh with CycloneDDS as RMW
2 parents d50936c + 67111aa commit f203869

3 files changed

Lines changed: 70 additions & 4 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,33 @@ ARG GIT_REPO_VERSION_DATE="unknown"
4040
ENV GIT_REPO_VERSION=${GIT_REPO_VERSION}
4141
ENV GIT_REPO_VERSION_DATE=${GIT_REPO_VERSION_DATE}
4242

43-
RUN mkdir -p /root/workspace/src
44-
COPY . /root/workspace/src/repository
45-
WORKDIR /root/workspace/
43+
# Install CycloneDDS ROS middleware implementation
44+
RUN apt-get update \
45+
&& apt-get install -qq -y --no-install-recommends \
46+
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
47+
&& rm -rf /var/lib/apt/lists/*
48+
49+
# Install additional Python packages required by the application
50+
COPY src/rosbag_blackbox/requirements.txt /tmp/requirements.txt
51+
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt && rm /tmp/requirements.txt
52+
53+
# Use CycloneDDS as the default ROS Middleware
54+
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
55+
56+
# Path to the colcon workspace inside the container
57+
ENV WORKSPACE_DIR=/root/workspace
58+
59+
RUN mkdir -p ${WORKSPACE_DIR}/src
60+
COPY . ${WORKSPACE_DIR}/src/repository
61+
WORKDIR ${WORKSPACE_DIR}
4662
RUN rosdep update --rosdistro ${ROS_DISTRO} && apt-get update \
4763
&& rosdep install --from-paths ./src --ignore-src -r -y \
48-
&& bash -c "source /opt/ros/${ROS_DISTRO}/setup.sh; colcon build"
64+
&& bash -c "source /opt/ros/${ROS_DISTRO}/setup.sh; colcon build" \
65+
&& rm -rf /var/lib/apt/lists/*
66+
67+
COPY entrypoint.sh /entrypoint.sh
68+
RUN chmod +x /entrypoint.sh
69+
70+
ENTRYPOINT ["/entrypoint.sh"]
71+
CMD ["ros2", "launch", "rosbag_blackbox", "rosbag_blackbox.launch.py"]
4972

docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
# Service name matches the ROS package; image name mirrors the GitHub repository name
3+
rosbag_blackbox:
4+
image: ghcr.io/jabasai/rosbag_ringbuffer:latest
5+
build:
6+
context: .
7+
dockerfile: .devcontainer/Dockerfile
8+
target: final
9+
args:
10+
BASE_IMAGE: ros:humble
11+
environment:
12+
# Use CycloneDDS as the ROS Middleware
13+
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
14+
ports:
15+
# Expose the FastAPI + MCP server port; host port is allocated dynamically
16+
- "8001"
17+
volumes:
18+
# Mount a local config file (override the bundled example_config.yaml)
19+
- ./src/rosbag_blackbox/config/example_config.yaml:/config/config.yaml:ro
20+
# Persist snapshots to the host
21+
- ./bags:/bags
22+
command:
23+
- ros2
24+
- launch
25+
- rosbag_blackbox
26+
- rosbag_blackbox.launch.py
27+
- snapshot_dir:=/bags
28+
- config_file:=/config/config.yaml

entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Source ROS 2 base environment
5+
# shellcheck disable=SC1091
6+
source /opt/ros/${ROS_DISTRO}/setup.bash
7+
8+
# Source the built colcon workspace if it exists
9+
WORKSPACE_DIR=${WORKSPACE_DIR:-/root/workspace}
10+
if [ -f "${WORKSPACE_DIR}/install/setup.bash" ]; then
11+
# shellcheck disable=SC1091
12+
source "${WORKSPACE_DIR}/install/setup.bash"
13+
fi
14+
15+
exec "$@"

0 commit comments

Comments
 (0)