From 8365f0a878bde915876a91967ea3b0b532e28029 Mon Sep 17 00:00:00 2001 From: Alberto Tudela Date: Tue, 15 Oct 2024 09:37:07 +0200 Subject: [PATCH] Update docker Signed-off-by: Alberto Tudela --- .github/workflows/docker_image.yml | 2 +- Dockerfile | 1 - docker-compose.yaml | 24 +++++++++++++++++++----- docker/ros_entrypoint.sh | 20 ++++++++++++-------- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml index ff7687e..f5ab5dd 100644 --- a/.github/workflows/docker_image.yml +++ b/.github/workflows/docker_image.yml @@ -28,7 +28,7 @@ jobs: with: images: grupoavispa/scitos2 tags: | - type=ref, suffix=latest, event=branch + type=ref, event=branch type=sha - name: Docker Setup Buildx diff --git a/Dockerfile b/Dockerfile index 5ef2f10..446b8e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -68,4 +68,3 @@ COPY ./docker/ros_entrypoint.sh / RUN chmod +x /ros_entrypoint.sh COPY ./docker/cyclonedds.xml / ENTRYPOINT ["/ros_entrypoint.sh"] -CMD ["ros2", "launch", "scitos2_mira", "mira.launch.py"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 5229dfb..91c1d5d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,8 +1,9 @@ services: - scitos: - container_name: scitos2 - image: grupoavispa/scitos2:latest + # Main container + base: + image: grupoavispa/scitos2:main build: . + tty: true network_mode: host ipc: host pid: host @@ -13,7 +14,20 @@ services: devices: - /dev/ttyUSB2:/dev/USB_MLCAN privileged: true - restart: unless-stopped volumes: - /opt/MIRA-licenses:/opt/MIRA-licenses - - /opt/SCITOS:/opt/SCITOS \ No newline at end of file + - /opt/SCITOS:/opt/SCITOS + + # Mira framework + drive & charger modules container + mira: + extends: + service: base + command: ros2 launch scitos2_mira mira.launch.py + restart: unless-stopped + + # Docking server container + docking: + extends: + service: base + command: ros2 launch scitos2_charging_dock docking_server.launch.py + restart: unless-stopped diff --git a/docker/ros_entrypoint.sh b/docker/ros_entrypoint.sh index ac491f7..7d29c85 100644 --- a/docker/ros_entrypoint.sh +++ b/docker/ros_entrypoint.sh @@ -2,15 +2,19 @@ set -e ######### ROS ######### -source /opt/ros/${ROS_DISTRO}/setup.bash -source ${OVERLAY_WS}/install/local_setup.bash -export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -export CYCLONEDDS_URI=/cyclonedds.xml +if [ -d /opt/ros/$ROS_DISTRO ]; then + source /opt/ros/${ROS_DISTRO}/setup.bash + source ${OVERLAY_WS}/install/local_setup.bash + export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + export CYCLONEDDS_URI=/cyclonedds.xml +fi ######### MIRA ######### -export MIRA_PATH=${MIRA_WS} -export PATH=$PATH:${MIRA_WS}/bin -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MIRA_WS}/lib -source ${MIRA_WS}/scripts/mirabash +if [ -d $MIRA_WS/mira ]; then + export MIRA_PATH=${MIRA_WS} + export PATH=$PATH:${MIRA_WS}/bin + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MIRA_WS}/lib + source ${MIRA_WS}/scripts/mirabash +fi exec "$@" \ No newline at end of file