Skip to content

Commit

Permalink
🔨 Ported latest modifications from humble_devel for better docker run…
Browse files Browse the repository at this point in the history
…ning.

Signed-off-by: Bey Hao Yun <beyhy94@gmail.com>
  • Loading branch information
cardboardcode committed Aug 13, 2024
1 parent bea206b commit 47516ed
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
build/*
install/*
log/*
.vscode/*
lcov/*
*.png
*.jpeg

Expand Down
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
FROM ros:jazzy-perception-noble

MAINTAINER Bey Hao Yun <beyhy94@gmail.com>
# 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"]
3 changes: 3 additions & 0 deletions scripts/0_build_docker_image.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker build --tag vcam_image:jazzy .
16 changes: 16 additions & 0 deletions scripts/1_create_docker_container.bash
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 47516ed

Please sign in to comment.