initial commit

This commit is contained in:
yenon 2022-09-01 11:39:26 +02:00
commit a0bce838f2
3 changed files with 65 additions and 0 deletions

12
build_ros/Dockerfile Executable file
View File

@ -0,0 +1,12 @@
ARG ROS=humble
FROM osrf/ros:${ROS}-desktop
RUN apt-get update -y
RUN apt-get install -y ros-galactic-ros-ign-gazebo
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6
RUN apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-utils mesa-utils
ARG UID=1000
ARG GID=1000
run groupadd -f -g $GID ros
RUN useradd -u $UID -g $GID -m ros
RUN usermod -aG video ros
RUN usermod -aG render ros

24
docker-compose.yaml Executable file
View File

@ -0,0 +1,24 @@
version: "3.2"
services:
ros:
image: ros/custom
build:
context: ./build_ros
args:
ROS: galactic #Desired ROS version
user: 1000:1000 #Fill in your id's here. (UID:GUI)
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./ros:/home/ros
devices:
- /dev/dri:/dev/dri
environment:
- DISPLAY=$DISPLAY
- XAUTHORITY=$XAUTHORITY
entrypoint: /bin/bash
stdin_open: true
tty: true
#group_add:
# - video
# - render

29
start.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
sudo docker-compose build
sudo docker-compose up -d
up_result=$(sudo docker-compose ps -q)
hosts=()
while read line; do
hosts+=(`sudo docker inspect --format='{{ .Config.Hostname }}' $line`)
#xhost +local:`sudo docker inspect --format='{{ .Config.Hostname }}' $line`
done <<< "$up_result"
echo "Adding to xhost:"
for host in ${hosts[@]}; do
echo " + $host"
xhost "+local:$host"
done
echo "Attaching."
echo "You are ready for shell access."
sudo docker-compose up
echo "Removing from xhost:"
for host in ${hosts[@]}; do
echo " - $host"
xhost "-local:$host"
done