Skip to content

Commit

Permalink
🔨 Updated foxy_devel with nitpicked commits from humble_devel branch.
Browse files Browse the repository at this point in the history
Signed-off-by: Bey Hao Yun <[email protected]>
  • Loading branch information
cardboardcode committed Aug 31, 2024
1 parent 590c42d commit 5f1cc88
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
FROM ros:foxy-ros-base-focal

MAINTAINER Bey Hao Yun <[email protected]>

# Add user
RUN adduser --quiet --disabled-password user

ENV DEBIAN_FRONTEND=noninteractive

# Install OpenCV
RUN apt-get update && \
apt-get install -y libopencv-dev && \
apt-get install -y ros-foxy-cv-bridge && \
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

# Get ROS2 package image_tools available for sourcing.
RUN chown -R user:user /home/user/
USER user
RUN git clone https://github.com/ros2/demos.git \
--branch foxy \
--single-branch \
--depth 1

WORKDIR /home/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:foxy .
15 changes: 15 additions & 0 deletions scripts/1_create_docker_container.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/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:foxy bash -c \
"ros2 run virtual_camera virtual_camera"

xhost -local:docker

0 comments on commit 5f1cc88

Please sign in to comment.