diff --git a/.gitignore b/.gitignore index 0c031ee..f09a8d1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ build/* install/* log/* +.vscode/* +lcov/* *.png *.jpeg diff --git a/Dockerfile b/Dockerfile index ab034ab..a08a403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,25 @@ FROM ros:jazzy-perception-noble -MAINTAINER Bey Hao Yun +# Add user +RUN adduser --quiet --disabled-password user +ENV DEBIAN_FRONTEND=noninteractive # Install OpenCV RUN apt-get update && \ apt-get install -y xauth xxd x11-xserver-utils && \ rm -rf /var/lib/apt/lists/* -WORKDIR /home/user +WORKDIR /home/user/virtual_camera_ws +RUN mkdir src +COPY . src/virtual_camera + +# colcon compilation +RUN . /opt/ros/$ROS_DISTRO/setup.sh \ + && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release + +RUN sed -i '$isource "/home/user/virtual_camera_ws/install/setup.bash"' /ros_entrypoint.sh + +RUN chown -R user:user /home/user/ +USER user + +ENTRYPOINT ["/ros_entrypoint.sh"] diff --git a/scripts/0_build_docker_image.bash b/scripts/0_build_docker_image.bash new file mode 100644 index 0000000..e737695 --- /dev/null +++ b/scripts/0_build_docker_image.bash @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker build --tag vcam_image:jazzy . diff --git a/scripts/1_create_docker_container.bash b/scripts/1_create_docker_container.bash new file mode 100644 index 0000000..a023b51 --- /dev/null +++ b/scripts/1_create_docker_container.bash @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +xhost +local:docker + +docker run -it --rm \ + --net host \ + --name vcam_test_container \ + -e DISPLAY=$DISPLAY \ + -v /dev/shm:/dev/shm \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -u user \ + vcam_image:jazzy bash -c \ + "ros2 launch virtual_camera showimageraw.launch.py \ + use_image_viewer:=true" + +xhost -local:docker