Compare commits

..

No commits in common. "4239391ab7e91854268c5ad75df283cf646df0ae" and "245b5325e6388098eca93fdb2cd4262ab518eb50" have entirely different histories.

4 changed files with 16 additions and 24 deletions

View File

@ -1,5 +1,5 @@
ARG ROS=humble ARG ROS=humble
FROM osrf/ros:${ROS}-desktop-full FROM osrf/ros:${ROS}-desktop
#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-tools mesa-utils && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-utils mesa-utils && rm -rf /var/lib/apt/lists/*
#Utils #Utils
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/* RUN apt-get update && apt-get install -y git ninja-build git bash-completion clangd-12 && rm -rf /var/lib/apt/lists/*
#Rosdeps #Rosdeps
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 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 mkdir /run/sshd RUN mkdir /run/sshd

View File

@ -30,10 +30,7 @@ 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 "export DISPLAY=$DISPLAY" > /etc/profile.d/display.sh printf "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: humble #Desired ROS version ROS: galactic #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,14 +1,9 @@
#!/bin/bash #!/bin/bash
if [[ "$EUID" = 0 ]]; then pushd $(dirname "$0")
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 home mkdir $(dirname "$0")/home
fi fi
if [ ! -d "home/.ssh" ]; then if [ ! -d "home/.ssh" ]; then
@ -20,23 +15,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 -r line; do while read 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
@ -45,9 +40,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 || exit popd