Files
ros-raspbot-v2/lidar/Dockerfile
T
m5p3nc3r 0174cb599f Manage sllidar_ros2 as a git subtree and apply QoS fix
- Add m5p3nc3r/sllidar_ros2 fork as a git subtree at lidar/sllidar_ros2/
- Dockerfile now COPYs source from the workspace instead of cloning at
  build time; git is no longer a build dependency
- Set /scan publisher QoS to BEST_EFFORT (depth 2) for Nav2/RViz2 compat
- Add lidar/README.md documenting the subtree workflow
- Remove lidar/sllidar_ros2/ from .gitignore (no longer needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 11:54:06 +00:00

41 lines
1.6 KiB
Docker

# syntax=docker/dockerfile:1
# ── Stage 1: build ────────────────────────────────────────────────────────────
FROM ros:kilted AS builder
SHELL ["/bin/bash", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-colcon-common-extensions \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /ws
# Source is managed as a git subtree — copy directly from the workspace
COPY lidar/sllidar_ros2/ src/sllidar_ros2/
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --packages-select sllidar_ros2
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM ros:kilted-ros-core
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rclcpp \
ros-${ROS_DISTRO}-sensor-msgs \
ros-${ROS_DISTRO}-std-srvs \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /ws/install /ws/install
# Source both ROS base and the workspace overlay on every shell/exec
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /etc/bash.bashrc && \
echo "source /ws/install/setup.bash" >> /etc/bash.bashrc
# Reuse the same entrypoint as the robot container (sources overlays, starts daemon)
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["ros2", "launch", "sllidar_ros2", "sllidar_a1_launch.py"]