Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use per ROS distro dev containers #438

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: "3"
services:
dev:
build:
context: ..
dockerfile: docker/images/${ROSDISTRO:-humble}/Dockerfile
image: ekumenlabs/beluga-${ROSDISTRO:-humble}-dev
container_name: beluga-dev
hostname: beluga-${ROSDISTRO:-humble}-dev
container_name: beluga-${ROSDISTRO:-humble}-dev
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
Expand Down
17 changes: 5 additions & 12 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,11 @@ while [[ "$1" != "" ]]; do
esac
done

DEV_CONTAINER_NAME=beluga_dev

# Kill the container JIC it already exists, if building, to ensure we don't attach to an old container.
[[ "$BUILD" = true ]] && docker compose build dev && docker rm -f $DEV_CONTAINER_NAME 2>/dev/null
[[ "$BUILD" = true ]] && docker compose build dev && docker compose rm -fs dev 2>/dev/null

# Check if the container exists
if docker ps -a --format '{{.Names}}' | grep -q $DEV_CONTAINER_NAME; then
# Attach to the container if it is running
echo "Found dev container running, attaching to it..."
else
echo "Container '$DEV_CONTAINER_NAME' does not exist or is not running, proceeding to run it."
PRIVILEGED_CONTAINER=$PRIVILEGED_CONTAINER USERID=$(id -u) GROUPID=$(id -g) docker compose run --rm --detach --name $DEV_CONTAINER_NAME dev
fi
# Start up dev container in the background (a no-op if configuration has not changed).
PRIVILEGED_CONTAINER=$PRIVILEGED_CONTAINER USERID=$(id -u) GROUPID=$(id -g) docker compose up --detach dev

docker exec -it $DEV_CONTAINER_NAME /ros_entrypoint.sh /bin/bash
# Enter shell within dev container.
docker compose exec dev /bin/bash
Loading