Files
ros-raspbot-v2/lidar/Dockerfile
T

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 \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /ws
RUN git clone --depth 1 https://github.com/slamtec/sllidar_ros2.git 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"]