Skip to content

Commit

Permalink
Added docker file and docker compose to dockerize rolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivang Vijay committed Mar 8, 2024
1 parent ae14222 commit 07192f5
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM osrf/ros:rolling-desktop
SHELL ["/bin/bash", "-c"]

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN apt update
COPY . /app/src/rmw_zenoh
WORKDIR /app
RUN rosdep install --from-paths src --ignore-src --rosdistro rolling -y
RUN source /opt/ros/rolling/setup.bash && source "$HOME/.cargo/env" && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

SHELL ["/bin/bash", "-c"]
ENTRYPOINT ["/app/src/rmw_zenoh/entrypoint.sh"]
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.2'
services:
router:
build:
context: .
image: zenoh:latest
stdin_open: true
tty: true
container_name: router_container
command: router
volumes:
- /dev/shm:/dev/shm
network_mode: host


talker:
build:
context: .
image: zenoh:latest
stdin_open: true
tty: true
container_name: talker_container
command: talker
volumes:
- /dev/shm:/dev/shm
network_mode: host
depends_on:
- router

listener:
build:
context: .
image: zenoh:latest
stdin_open: true
tty: true
container_name: listener_container
command: listener
volumes:
- /dev/shm:/dev/shm
network_mode: host
depends_on:
- router

21 changes: 21 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

source ./install/setup.bash

if [ $1 = "router" ]
then
ros2 run rmw_zenoh_cpp rmw_zenohd
fi

if [ $1 = "talker" ]
then
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 run demo_nodes_cpp talker
fi

if [ $1 = "listener" ]
then
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 run demo_nodes_cpp listener
fi

0 comments on commit 07192f5

Please sign in to comment.