Refactor Dockerfile and update dependency management for improved clarity; enhance README with dependency details and installation instructions

This commit is contained in:
Akash Shingha 2026-03-12 17:11:03 +02:00
parent f151a78ebd
commit 7d4eca3c46
6 changed files with 39 additions and 10 deletions

View File

@ -3,10 +3,10 @@ SHELL ["/bin/bash", "-lc"]
WORKDIR /ws WORKDIR /ws
# Install build dependencies # Install build dependencies
COPY apt-requirements.txt /tmp/requirements.txt COPY apt-requirements.txt /tmp/apt-build.txt
RUN apt-get update \ RUN apt-get update \
&& xargs -a /tmp/requirements.txt apt-get install -y --no-install-recommends \ && grep -Ev '^[[:space:]]*($|#)' /tmp/apt-build.txt | xargs apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /tmp/requirements.txt && rm -rf /var/lib/apt/lists/* /tmp/apt-build.txt
# Copy package manifest and install rosdeps # Copy package manifest and install rosdeps
COPY package.xml ./package.xml COPY package.xml ./package.xml
@ -29,7 +29,7 @@ WORKDIR /ws
## Install minimal runtime packages required by the built binaries ## Install minimal runtime packages required by the built binaries
COPY apt-runtime.txt /tmp/apt-runtime.txt COPY apt-runtime.txt /tmp/apt-runtime.txt
RUN apt-get update \ RUN apt-get update \
&& xargs -a /tmp/apt-runtime.txt apt-get install -y --no-install-recommends \ && grep -Ev '^[[:space:]]*($|#)' /tmp/apt-runtime.txt | xargs apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /tmp/apt-runtime.txt && rm -rf /var/lib/apt/lists/* /tmp/apt-runtime.txt
COPY --from=build /ws/install /ws/install COPY --from=build /ws/install /ws/install

View File

@ -14,10 +14,34 @@ You are reading now the README for a **default** ROS2 package. If you want to us
## Dependencies ## Dependencies
- ROS2 Humble - ROS2 Humble
- Dependency files in this repository:
- `apt-requirements.txt`: build-only system dependencies.
- `apt-runtime.txt`: runtime system dependencies (minimal default set).
- `requirements.txt`: pip dependencies (currently none required).
- OpenCV policy: use APT package `python3-opencv` (do not install `opencv-python` via pip by default).
- Optional debug-only packages:
- `ros-humble-ros2cli`
- `net-tools`
- `iputils-ping`
- These are listed as commented entries in `apt-runtime.txt` and are not installed by default.
- gstreamer libs: - gstreamer libs:
```bash ```bash
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev libgstrtspserver-1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev libgstrtspserver-1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad
``` ```
For a minimal host setup using repository-managed lists:
```bash
sudo apt-get update
grep -Ev '^[[:space:]]*($|#)' apt-requirements.txt | xargs sudo apt-get install -y --no-install-recommends
grep -Ev '^[[:space:]]*($|#)' apt-runtime.txt | xargs sudo apt-get install -y --no-install-recommends
```
Install debug tools only when needed:
```bash
sudo apt-get install -y --no-install-recommends ros-humble-ros2cli net-tools iputils-ping
```
## Install ## Install
- Navigate to the root directory, create a new directory named `ros2_ws/src`, and then change the current working directory to `ros2_ws/src`: - Navigate to the root directory, create a new directory named `ros2_ws/src`, and then change the current working directory to `ros2_ws/src`:
```bashrc ```bashrc

View File

@ -3,12 +3,12 @@ build-essential
cmake cmake
pkg-config pkg-config
libopencv-dev libopencv-dev
python3-opencv
python3-rosdep python3-rosdep
python3-rosdistro python3-rosdistro
software-properties-common software-properties-common
libgstreamer1.0-dev libgstreamer1.0-dev
libgstreamer-plugins-base1.0-dev libgstreamer-plugins-base1.0-dev
libgstreamer-plugins-bad1.0-dev
libgstreamer-plugins-good1.0-dev libgstreamer-plugins-good1.0-dev
libgstrtspserver-1.0-dev libgstrtspserver-1.0-dev
ninja-build ninja-build

View File

@ -5,7 +5,10 @@ gstreamer1.0-plugins-bad
gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly
libgstrtspserver-1.0-0 libgstrtspserver-1.0-0
python3-opencv python3-opencv
ros-humble-ros2cli
ros-humble-rclpy ros-humble-rclpy
net-tools
iputils-ping # Optional debug-only tools (not required for normal runtime)
# Uncomment/install manually only when troubleshooting:
# ros-humble-ros2cli
# net-tools
# iputils-ping

View File

@ -16,7 +16,8 @@ services:
# Ensure the node binds to non-localhost interface (disable local_only) # Ensure the node binds to non-localhost interface (disable local_only)
# and subscribe to the actual image topic available on the host # and subscribe to the actual image topic available on the host
command: ["image2rtsp.launch.py", "local_only:=false", "topic:=/camera/image", "log_level:=debug"] #log_level:= info, debug, warning, error, fatal
command: ["image2rtsp.launch.py", "local_only:=false", "topic:=/camera/image", "log_level:=info"]
restart: unless-stopped restart: unless-stopped

View File

@ -1 +1,2 @@
opencv-python # No required pip dependencies.
# OpenCV is provided via apt package: python3-opencv.