Skip to content

Use pre-built Docker images in CI to reduce setup time #240

@bburda

Description

@bburda

Summary

CI spends ~3 minutes per job on setup-ros and apt-get install to install ROS 2 and project dependencies. With 4+ parallel jobs (Jazzy build, Jazzy lint, Jazzy test, Humble, Rolling, coverage), this adds up to ~18 minutes of total compute time on redundant setup.

Pre-building Docker images with ROS 2 and project dependencies pre-installed would eliminate this overhead.


Proposed solution (optional)

Build and publish Docker images to GHCR with ROS 2 + all project deps:

# Example for Jazzy
FROM ros:jazzy
RUN apt-get update && apt-get install -y \
  ccache clang-format clang-tidy lcov \
  ros-jazzy-test-msgs \
  && rm -rf /var/lib/apt/lists/*
COPY src /tmp/src
RUN . /opt/ros/jazzy/setup.sh \
  && rosdep update \
  && rosdep install --from-paths /tmp/src --ignore-src -y \
  && rm -rf /tmp/src

A separate workflow would rebuild images weekly or on dependency changes, publishing to ghcr.io/selfpatch/ros2_medkit-ci:jazzy / :humble.

CI jobs would then use:

container:
  image: ghcr.io/selfpatch/ros2_medkit-ci:${{ matrix.ros_distro }}

Expected savings: ~3-4 min per job, ~18 min total compute across all jobs.


Additional context (optional)

Current CI timing breakdown (Jazzy job):

  • Setup ROS 2: ~3 min
  • Install dependencies: ~30s
  • Build: ~5 min (1.5 min with warm ccache)
  • Linters: ~20 min
  • Tests: ~3 min

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions