Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Dockerfiles #110

Merged
merged 8 commits into from
Dec 12, 2022
Merged

Optimize Dockerfiles #110

merged 8 commits into from
Dec 12, 2022

Conversation

ruffsl
Copy link
Contributor

@ruffsl ruffsl commented Dec 12, 2022

I was looking at the source Dockerfile for the ghcr.io/foxglove/rolling-ros2-bridge image, and noticed some optimizations that could be made. See commit history for details.

The only major change is swapping the base image for the ros2 bridge from ros-core over to ros-base:

REPOSITORY                TAG                SIZE
foxglove_bridge_rolling   base (after)       1.03GB
foxglove_bridge_rolling   core (before)      945MB
ros                       rolling-ros-base   752MB
ros                       rolling-ros-core   474MB
ubuntu                    jammy              77.8MB

I did this as most of the large dependencies being manually installed should already be provided by the base tag. While the resulting image is a little larger (1.03GB-945MB)=85MB, the resulting size of the added layers to be regularly pushed over the network and saved to disk with every update to the bridge image is reduced from (945MB-474MB)=471MB to just (1.03GB-752MB)=278MB. Given 1) most robots using docker are more likely to have at least the image layers for the ros-base tag cached locally already for other running ROS containers, 2) the lower cadence of changed layers in the ros-base image, this should help reduce the bandwidth and storage requirements for deploying these bridge images.

@CLAassistant
Copy link

CLAassistant commented Dec 12, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@achim-k achim-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!


# Install rosdep dependencies
RUN . /opt/ros/$ROS_DISTRIBUTION/setup.sh && \
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
Copy link
Contributor

@jhurliman jhurliman Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where $ROS_DISTRO is being set

EDIT: I'm told $ROS_DISTRO is set in the base image

@jhurliman jhurliman merged commit 8ab2fc6 into foxglove:main Dec 12, 2022
@ruffsl ruffsl deleted the dockerfile branch December 12, 2022 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants