Compare commits
No commits in common. "44f9d1dd2a64f57e3b6ddc98fb005a550772207b" and "913797e8146d8a8adfa402798596cb30fe0dcb41" have entirely different histories.
44f9d1dd2a
...
913797e814
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
|
/*
|
||||||
!/docker-compose.yaml
|
!/docker-compose.yaml
|
||||||
!/build_ros
|
!/build_ros
|
||||||
!/start.sh
|
!/start.sh
|
||||||
!/shell.sh
|
|
||||||
!/.gitignore
|
!/.gitignore
|
||||||
/home
|
|
||||||
|
|||||||
@ -1,26 +1,11 @@
|
|||||||
ARG ROS=humble
|
ARG ROS=humble
|
||||||
FROM osrf/ros:${ROS}-desktop
|
FROM osrf/ros:${ROS}-desktop
|
||||||
|
RUN apt-get update && apt-get install -y ros-galactic-ros-ign-gazebo
|
||||||
|
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
|
||||||
|
RUN apt-get update && apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-utils mesa-utils
|
||||||
|
|
||||||
#SSH (First to hopefully keep keys, even on modification.)
|
ARG GID=1000
|
||||||
RUN apt-get update && apt-get install -y openssh-server && rm -rf /var/lib/apt/lists/*
|
ARG UID=1000
|
||||||
RUN mkdir /run/sshd
|
|
||||||
RUN ssh-keygen -A
|
|
||||||
#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/*
|
|
||||||
#Vulkan
|
|
||||||
RUN apt-get update && apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-utils mesa-utils && rm -rf /var/lib/apt/lists/*
|
|
||||||
#Utils
|
|
||||||
RUN apt-get update && apt-get install -y git ninja-build git bash-completion && rm -rf /var/lib/apt/lists/*
|
|
||||||
#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/*
|
|
||||||
|
|
||||||
ARG G_ID=1000
|
RUN groupadd -f -g $GID ros
|
||||||
ARG U_ID=1000
|
RUN useradd -u $UID -g $GID -m ros
|
||||||
|
|
||||||
RUN groupadd -f -g ${G_ID} ros
|
|
||||||
RUN useradd -u ${U_ID} -g ${G_ID} -m ros
|
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
CMD ["/usr/bin/bash", "-c", "/entrypoint.sh", "${ROS_NAME}"]
|
|
||||||
|
|||||||
@ -1,37 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ ! -f /home/ros/docker_image_version ]; then
|
groupadd -f -g $GID ros
|
||||||
echo "0" > /home/ros/docker_image_version
|
useradd -u $UID -g $GID -m ros
|
||||||
fi
|
usermod -aG video ros
|
||||||
|
usermod -aG render ros
|
||||||
|
chown -R $UID:$GID /home/ros
|
||||||
|
|
||||||
chsh -s /usr/bin/bash ros
|
exec su ros -c "/ros_entrypoint.sh $@"
|
||||||
|
|
||||||
if [ "0" == "$(cat /home/ros/docker_image_version)" ]; then
|
|
||||||
echo "Performing initial setup..."
|
|
||||||
|
|
||||||
cp /etc/skel/.* /home/ros
|
|
||||||
chown -R ros:ros /home/ros
|
|
||||||
|
|
||||||
su ros -c "echo 'source ~/.rosrc' >> ~/.bashrc"
|
|
||||||
echo "Modified .bashrc"
|
|
||||||
su ros -c "mkdir -p /home/ros/workspace/src"
|
|
||||||
echo "Created workspace"
|
|
||||||
su ros -c "cd /home/ros/workspace; colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja"
|
|
||||||
echo "Built workspace"
|
|
||||||
printf "1" > /home/ros/docker_image_version
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /home/ros/.ssh/id_rsa ]; then
|
|
||||||
su ros -c "ssh-keygen -N '' -f /home/ros/.ssh/id_rsa"
|
|
||||||
echo "Generated SSH Keys."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "ros:ros" | chpasswd
|
|
||||||
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
|
|
||||||
|
|
||||||
echo "Ready to connect."
|
|
||||||
|
|
||||||
/usr/sbin/sshd -p 2222 -D
|
|
||||||
|
|||||||
@ -2,12 +2,13 @@ version: "3.2"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
ros:
|
ros:
|
||||||
hostname: ros
|
|
||||||
image: ros/custom
|
image: ros/custom
|
||||||
build:
|
build:
|
||||||
context: ./build_ros
|
context: ./build_ros
|
||||||
args:
|
args:
|
||||||
ROS: galactic #Desired ROS version
|
ROS: galactic #Desired ROS version
|
||||||
|
UID: ${U_ID}
|
||||||
|
GID: ${G_ID}
|
||||||
volumes:
|
volumes:
|
||||||
- /tmp/.X11-unix:/tmp/.X11-unix:rw
|
- /tmp/.X11-unix:/tmp/.X11-unix:rw
|
||||||
- ./home:/home/ros
|
- ./home:/home/ros
|
||||||
@ -16,10 +17,11 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- DISPLAY=$DISPLAY
|
- DISPLAY=$DISPLAY
|
||||||
- XAUTHORITY=$XAUTHORITY
|
- XAUTHORITY=$XAUTHORITY
|
||||||
|
- U_ID=${U_ID}
|
||||||
|
- G_ID=${G_ID}
|
||||||
|
user: ${U_ID}:${G_ID}
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
ports:
|
|
||||||
- "2222:2222"
|
|
||||||
#group_add:
|
#group_add:
|
||||||
# - video
|
# - video
|
||||||
# - render
|
# - render
|
||||||
|
|||||||
5
start.sh
5
start.sh
@ -3,10 +3,6 @@
|
|||||||
mkdir $(dirname "$0")/home
|
mkdir $(dirname "$0")/home
|
||||||
|
|
||||||
sudo docker-compose down
|
sudo docker-compose down
|
||||||
|
|
||||||
echo U_ID="$(id -u)" > $(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
|
||||||
|
|
||||||
@ -26,6 +22,7 @@ for host in ${hosts[@]}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Attaching."
|
echo "Attaching."
|
||||||
|
echo "You are ready for shell access."
|
||||||
sudo docker-compose up
|
sudo docker-compose up
|
||||||
|
|
||||||
echo "Removing from xhost:"
|
echo "Removing from xhost:"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user