Compare commits

..

7 Commits

Author SHA1 Message Date
4239391ab7 Changed dependencies 2023-04-20 22:22:12 +02:00
420184e733 Changes to used packages 2023-02-16 17:34:54 +01:00
5f760e47ea Migrate to ROS2 humble 2022-11-22 09:47:57 +01:00
f34088a1e7 Fixed startscript (ShellCheck.net) 2022-11-17 15:21:54 +01:00
Bastian Hofmann
ab21b4c285 Fix folder path
Added root prevention
2022-11-14 15:58:09 +01:00
Bastian Hofmann
2ddbf88d8b Merge branch 'master' of ssh://bitbucket.xitaso.com/ri/docker_ros_x11 2022-11-14 15:53:34 +01:00
Bastian Hofmann
f1d6d516d1 Additional environment vars 2022-11-14 15:47:49 +01:00
4 changed files with 24 additions and 16 deletions

View File

@ -1,5 +1,5 @@
ARG ROS=humble ARG ROS=humble
FROM osrf/ros:${ROS}-desktop FROM osrf/ros:${ROS}-desktop-full
#SSH (First to hopefully keep keys, even on modification.) #SSH (First to hopefully keep keys, even on modification.)
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/*
@ -7,11 +7,11 @@ RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/l
#OpenGL #OpenGL
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6 && rm -rf /var/lib/apt/lists/* RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y xserver-xorg-video-all libgl1-mesa-glx libgl1-mesa-dri libglvnd0 libgl1 libglx0 libegl1 libxext6 libx11-6 && rm -rf /var/lib/apt/lists/*
#Vulkan #Vulkan
RUN apt-get update && apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-utils mesa-utils && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-tools mesa-utils && rm -rf /var/lib/apt/lists/*
#Utils #Utils
RUN apt-get update && apt-get install -y git ninja-build git bash-completion clangd-12 && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y gdb clang-format git ninja-build git bash-completion clangd ccls && rm -rf /var/lib/apt/lists/*
#Rosdeps #Rosdeps
RUN apt-get update && apt-get install -y git ros-galactic-ament-cmake ros-galactic-moveit ros-galactic-behaviortree-cpp-v3 ros-galactic-ros-ign-gazebo && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y ros-humble-ament-cmake ros-humble-moveit ros-humble-behaviortree-cpp-v3 ros-humble-gazebo-ros ros-humble-ros-gz-sim ros-humble-ros2-control ros-humble-gazebo-ros2-control ros-humble-ros2-controllers ros-humble-moveit-ros-control-interface && rm -rf /var/lib/apt/lists/*
RUN mkdir /run/sshd RUN mkdir /run/sshd

View File

@ -30,7 +30,10 @@ fi
echo "ros:ros" | chpasswd echo "ros:ros" | chpasswd
su ros -c "printf 'source /opt/ros/$ROS_DISTRO/setup.bash\nsource /home/ros/workspace/install/setup.bash' > ~/.rosrc" su ros -c "printf 'source /opt/ros/$ROS_DISTRO/setup.bash\nsource /home/ros/workspace/install/setup.bash' > ~/.rosrc"
printf "DISPLAY=$DISPLAY" > /etc/profile.d/display.sh printf "export DISPLAY=$DISPLAY" > /etc/profile.d/display.sh
printf "export XAUTHORITY=$XAUTHORITY" > /etc/profile.d/xauth.sh
chmod +x /etc/profile.d/display.sh
chmod +x /etc/profile.d/xauth.sh
echo "Ready to connect." echo "Ready to connect."

View File

@ -7,7 +7,7 @@ services:
build: build:
context: ./build_ros context: ./build_ros
args: args:
ROS: galactic #Desired ROS version ROS: humble #Desired ROS version
volumes: volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw - /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./home:/home/ros - ./home:/home/ros

View File

@ -1,9 +1,14 @@
#!/bin/bash #!/bin/bash
pushd $(dirname "$0") if [[ "$EUID" = 0 ]]; then
printf "Please run as user. I will invoke sudo when needed."
exit
fi
pushd "$(dirname "$0")" || exit
if [ ! -d "home" ]; then if [ ! -d "home" ]; then
mkdir $(dirname "$0")/home mkdir home
fi fi
if [ ! -d "home/.ssh" ]; then if [ ! -d "home/.ssh" ]; then
@ -15,23 +20,23 @@ grep -sqF -- "$ident" "home/.ssh/authorized_keys" || echo "$ident" >> "home/.ssh
sudo docker-compose down sudo docker-compose down
echo U_ID="$(id -u)" > $(dirname "$0")/.env echo U_ID="$(id -u)" > "$(dirname "$0")/.env"
echo G_ID="$(id -g)" >> $(dirname "$0")/.env echo G_ID="$(id -g)" >> "$(dirname "$0")/.env"
sudo U_ID="$(id -u)" G_ID="$(id -g)" docker-compose build sudo U_ID="$(id -u)" G_ID="$(id -g)" docker-compose build
sudo U_ID="$(id -u)" G_ID="$(id -g)" docker-compose up -d sudo U_ID="$(id -u)" G_ID="$(id -g)" docker-compose up -d
up_result=$(sudo docker-compose ps -q) up_result="$(sudo docker-compose ps -q)"
hosts=() hosts=()
while read line; do while read -r line; do
hosts+=(`sudo docker inspect --format='{{ .Config.Hostname }}' $line`) hosts+=("$(sudo docker inspect --format='{{ .Config.Hostname }}' "$line")")
#xhost +local:`sudo docker inspect --format='{{ .Config.Hostname }}' $line` #xhost +local:`sudo docker inspect --format='{{ .Config.Hostname }}' $line`
done <<< "$up_result" done <<< "$up_result"
echo "Adding to xhost:" echo "Adding to xhost:"
for host in ${hosts[@]}; do for host in "${hosts[@]}"; do
echo " + $host" echo " + $host"
xhost "+local:$host" xhost "+local:$host"
done done
@ -40,9 +45,9 @@ echo "Attaching."
sudo docker-compose up sudo docker-compose up
echo "Removing from xhost:" echo "Removing from xhost:"
for host in ${hosts[@]}; do for host in "${hosts[@]}"; do
echo " - $host" echo " - $host"
xhost "-local:$host" xhost "-local:$host"
done done
popd popd || exit