From f7616f51dfd5abb5661fabc8270c3308f3aa6d8b Mon Sep 17 00:00:00 2001 From: Seb Tiburzio Date: Wed, 14 Feb 2024 16:49:59 +0100 Subject: [PATCH] Remove duplicated run config --- build.sh | 4 ++-- docker-compose.yml | 16 ++++++++++++++++ run.sh | 14 +++++--------- 3 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 docker-compose.yml diff --git a/build.sh b/build.sh index c0b518d..e386633 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")" +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker build --progress=plain -t ghcr.io/helix-robotics-ag/${REPOSITORY_NAME}:iron . \ No newline at end of file +docker compose -f $SCRIPT_DIR/docker-compose.yml build \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9deba3a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3' + +services: + ros-foxglove-bridge: + image: ghcr.io/helix-robotics-ag/ros-foxglove-bridge:iron + build: + context: . + dockerfile: Dockerfile + restart: always + network_mode: "host" + ipc: host + pid: host + environment: + - UID=${HOST_UID} + - ROS_DOMAIN_ID + command: su - ros --whitelist-environment=ROS_DOMAIN_ID /run.sh diff --git a/run.sh b/run.sh index ae065cf..89ffd12 100755 --- a/run.sh +++ b/run.sh @@ -1,12 +1,8 @@ #!/bin/bash -REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")" +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -docker run -it --rm \ ---network=host \ ---ipc=host \ ---pid=host \ ---env UID=${MY_UID} \ ---env ROS_DOMAIN_ID \ ---privileged \ -ghcr.io/helix-robotics-ag/${REPOSITORY_NAME}:iron +export HOST_UID=$(id -u) + +docker compose -f $SCRIPT_DIR/docker-compose.yml run \ +ros-foxglove-bridge bash \ No newline at end of file