Fix livox driver build

Also add caching to the apt-get installs
This commit is contained in:
Matt Spencer
2026-07-18 10:23:36 +00:00
parent 48eb4d10fd
commit 6cf51a3b67
3 changed files with 57 additions and 16 deletions
+16 -6
View File
@@ -18,19 +18,31 @@ RUN ./patches/apply_patches.sh
# NOTE: There should be a check in your CI that this file is up to date.
# Something like:
# ./scripts/freeze-rosdep.sh && git diff --exit-code rosdep-packages.txt
COPY rosdep-packages.txt /tmp/rosdep-packages.txt
# COPY rosdep-packages.txt /tmp/rosdep-packages.txt
# The --mount=type=cache option caches the apt packages with buildkit
# The id-apt-cache-${TARGETARCH} option allows for separate caches for different architectures
# this enables parallel builds for different architectures without cache conflicts
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
# rm -f /etc/apt/apt.conf.d/docker-clean \
# && apt-get update \
# && xargs -r -a /tmp/rosdep-packages.txt apt-get install -y --no-install-recommends \
# && rm -rf /var/lib/apt/lists/*
# Make sure the base image is completely up to date
# ros:jazzy ships /etc/apt/apt.conf.d/docker-clean which purges downloaded .debs;
# remove it so the --mount=type=cache on /var/cache/apt actually retains archives.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt-get update \
&& xargs -r -a /tmp/rosdep-packages.txt apt-get install -y --no-install-recommends \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies with rosdep
# This will catch anything that wasn't installed via .deb's from the frozen rosdep manifest.
RUN apt-get update && \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-cache-${TARGETARCH} \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get update && \
rosdep update && \
rosdep install --from-paths src --ignore-src -r -y && \
rm -rf /var/lib/apt/lists/*
@@ -38,9 +50,7 @@ RUN apt-get update && \
# Build the workspace with symlink install
# livox_sdk is now an ament_cmake package built by colcon (no manual /usr/local install needed).
RUN . /opt/ros/jazzy/setup.sh && \
colcon build --symlink-install \
--cmake-args -DROS_EDITION=ROS2 -DDISTRO_ROS=jazzy
colcon build --symlink-install
# Source the overlay on container startup
RUN echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc && \
echo "source /ros2_ws/install/setup.bash" >> /root/.bashrc