Clone https://github.com/micro-ROS/micro_ros_stm32cubemx_utils into your project. Navigate to <proj>/micro_ros_stm32cubemx_utils/microros_static_library/library_generation/extra_packages/
.
Recommended: Add your custom message package to extra_packages.repos. Alternatively, packages can be added directly to this directory (not recommended).
Follow the directions here.
docker pull microros/micro_ros_static_library_builder:humble
docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=micro_ros_stm32cubemx_utils/microros_static_library microros/micro_ros_static_library_builder:humble