cps_loki/docker-compose.yaml
2024-03-28 09:55:03 +01:00

290 lines
8.4 KiB
YAML

version: "3.9"
services:
# Base image containing dependencies.
base:
image: ghcr.io/bjoernellens1/cps_bot_mini_ws/base
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/cps_bot_mini_ws/base
args:
ROS_DISTRO: humble
UNDERLAY_WS: cps_bot_mini_ws
OVERLAY_WS: overlay_ws
target: base
x-bake:
platforms:
- linux/arm64
- linux/amd64
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
#privileged: true
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
restart: unless-stopped
# Overlay image containing the project specific source code.
overlay:
extends: base
image: ghcr.io/bjoernellens1/cps_bot_mini_ws/overlay
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/cps_bot_mini_ws/overlay
target: overlay
x-bake:
platforms:
- linux/arm64
- linux/amd64
volumes:
- .:/repo
# Additional dependencies for GUI applications
guis:
extends: overlay
image: ghcr.io/bjoernellens1/cps_bot_mini_ws/guis
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/cps_bot_mini_ws/guis
target: guis
x-bake:
platforms:
- linux/arm64
- linux/amd64
command: |
/bin/bash
# Robot State Publisher
robot_state_publisher:
extends: overlay
command: |
ros2 launch cps_loki_bringup rsp.launch.py
# Controller
controller:
extends: overlay
command: |
ros2 launch cps_loki_bringup robot_controller.launch.py
privileged: true
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
- /dev/ttyACM0:/dev/ttyACM0
restart: always
# teleop
teleop:
extends: overlay
command: |
ros2 launch cps_loki_bringup robot_joy_teleop.launch.py
devices:
- /dev/input:/dev/input
restart: always
# scan filter node
lidar_filter:
extends: overlay
command: |
ros2 launch cps_loki_bringup robot_scan_filter.launch.py
# lidar
lidar:
extends: overlay
depends_on:
- lidar_filter
command: |
ros2 launch cps_loki_bringup robot_lidar.launch.py
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
- /dev/ttyACM0:/dev/ttyACM0
# mapping
mapping:
extends: overlay
command: |
ros2 launch cps_loki_bringup robot_mapper.launch.py
# navigation
navigation:
extends: overlay
#command: >
# ros2 launch cbot_mini_bringup robot_navigation.launch.py
# map_subscribe_transient_local:=true
command: >
ros2 launch nav2_bringup bringup_launch.py slam:=True map:=/repo/map.yaml
use_sim_time:=False use_composition:=True
params_file:=/repo/config/nav2_params.yaml
depends_on:
- lidar
- controller
- teleop
# camera
cam:
extends: overlay
command: >
ros2 launch ffmpeg_image_transport cam.launch.py
privileged: true
devices:
- /dev/dri:/dev/dri
###################################################################################################################################
# Webgui control #
###################################################################################################################################
olivetin:
container_name: olivetin
image: jamesread/olivetin
#image: ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin
target: olivetin
x-bake:
platforms:
#- linux/arm64
- linux/amd64
user: root
privileged: true
volumes:
- ./config/olivetin/:/config/ # here is config.yaml and icons located
- ./config/olivetin/icons:/var/www/olivetin/customIcons
- .:/repo
- /var/run/docker.sock:/var/run/docker.sock
# - /var/lib/docker:/var/lib/docker
- ~/.ssh/id_rsa:/root/.ssh/id_rsa
networks:
- caddy_network
ports:
- "1337:1337"
restart: always
portainer:
container_name: portainer
#image: jamesread/olivetin
image: portainer/portainer-ce:latest
volumes:
- ./config/olivetin/:/config/ # here is config.yaml and icons located
- ./config/olivetin/icons:/var/www/olivetin/customIcons
- .:/repo
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
# - /var/lib/docker:/var/lib/docker
- ~/.ssh/id_rsa:/root/.ssh/id_rsa
ports:
- "8000:8000"
- "9443:9443"
restart: unless-stopped
################################################################################################################################
# This section is mostly for supervision from PC #
################################################################################################################################
# Foxglove Studio Bridge
foxglove_bridge:
extends: overlay
command: >
ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
foxglove:
#image: husarion/foxglove
image: ghcr.io/foxglove/studio:latest
restart: always
depends_on:
- foxglove_bridge
networks:
- caddy_network
ports:
- 8080:8080
volumes:
- ./config/foxglove/extensions:/src/extensions
- ./config/foxglove/foxglove-layout.json:/foxglove/default-layout.json
# rviz2
rviz2:
extends: guis
command: |
rviz2
# Needed to display graphical applications
privileged: true
################################################################################################################################
# Core Services for Web Management #
################################################################################################################################
caddy:
image: caddy:latest
networks:
- caddy_network
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "80:80"
- "443:443"
volumes:
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./config/caddy/content:/usr/share/caddy/
restart: always
depends_on:
- foxglove
- olivetin
roscore:
image: husarion/ros1-bridge:foxy-0.9.6-20230327-stable
command: |
bash -c "source /opt/ros/noetic/setup.bash && roscore"
network_mode: host
environment:
- ROS_DOMAIN_ID=5
restart: always
ros1bridge:
image: husarion/ros1-bridge:foxy-0.9.6-20230327-stable
command: |
ros2 run ros1_bridge dynamic_bridge
network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
restart: always
webui-joystick:
image: husarion/webui-ros-joystick:noetic-0.0.1-20230510-stable
network_mode: host
# networks:
# - caddy_network
# ports:
# - 8000:8000
ipc: host
environment:
- ROS_DOMAIN_ID=5
restart: always
depends_on:
- ros1bridge
command: roslaunch webui-ros-joystick webui.launch
################################################################################################################################
# Docker related extra stuff #
################################################################################################################################
networks:
caddy_network:
driver: bridge
volumes:
portainer_data:
npm-data:
npm-letsencrypt: