Build and Runtime Dependencies for Minimal Container.
Hi all,
I am trying to construct the absolute minimum sized ros-gazebo container possible. Currently using ros:foxy-ros-base-focal, I apt-install gazebo 11 (600Mb) and ros-foxy-gazebo-ros-pkgs (1.3Gb). This in total adds around 2Gb to any base installation.
# Setup common base for simulator images
FROM ros:foxy-ros-base-focal
###
# Steps from gazebo:gzserver11 Dockerfile
###
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
lsb-release \
&& rm -rf /var/lib/apt/lists/*
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
# setup sources.list
RUN . /etc/os-release \
&& echo "deb http://packages.osrfoundation.org/gazebo/$ID-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-latest.list
# install gazebo packages
RUN apt-get update && apt-get install -y --no-install-recommends \
gazebo11 \
&& rm -rf /var/lib/apt/lists/*
# setup environment
# Expose default gzserver port
EXPOSE 11345
###
# End of gazebo:gzserver11 steps
###
# Add gazebo environemnt setup to /ros.env
RUN echo "source /usr/share/gazebo/setup.sh" >> /ros.env
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ros-foxy-gazebo-ros-pkgs \
&& rm -rf /var/lib/apt/lists/*
I have looked at installing both packages from source (http://gazebosim.org/tutorials?tut=install_from_source&cat=install) (http://gazebosim.org/tutorials?tut=ros2_installing&cat=connect_ros), which provides a dependency install script. However I don't think this will help as (a) I will be installing both build and runtime dependncies, so it cannot be smaller than previously and (b) I could try and use a multi-stage build, but then I need to know where the gazebo/gazebo_ros binaries and libraries are, AND the runtime dependncies.
Also, there are probably a number of aspects of gazebo that I might not need (I am using it for simple ground and air vehicle sims) e.g. the variety of physics engines, probably other things. But I do not know how to configure such a build.
In addition, i'm trying to get this done asap so I don't have much time to look into build options and such.
Therefore! Aside from rebuilding a binary to my liking, I would like to know if the released apt-installed libraries have any extra or non-runtime libraries I may be able to delete. Also appreciate any further tips and tricks you might have!
Many Thanks!
Asked by __simplex__ on 2022-03-29 09:54:09 UTC
Comments