Skip to content

Conversation

@matthewjmarangoni
Copy link
Contributor

@matthewjmarangoni matthewjmarangoni commented Aug 22, 2025

This is a pass to reduce build times and image sizes. The impact varies but the general expectation is improvement.

Image size reductions of 18% - 30% and build time reductions of 7% - 35% were found. Some results were greater yet less consistent and should not be expected.

Changes to achieve this include:

  • Caching introduced for apt, npm, go, static ffmpeg builds
  • apt configuration changed to prevent automatic cache removal and to preserve downloads
  • Recommended apt packages are no longer installed
  • Removal of unused packages

Manual testing was done. Further testing is requested to verify impact and functionality. Particularly of interest are differing and constrained environments such as CI/CD pipelines.


TL;DR

Reduced Docker image sizes and build times by implementing widespread caching for apt, npm, go, and ffmpeg builds.

Why we made these changes

To reduce build times and image sizes for faster, more efficient CI/CD pipelines and local development. Image size reductions of 18% - 30% and build time reductions of 7% - 35% were observed in testing.

What changed?

  • Implemented Widespread Caching: Introduced Docker BuildKit cache mounts (--mount=type=cache) across multiple Dockerfiles to cache dependencies for apt, npm, go, and static ffmpeg builds.
  • Optimized apt Usage: Configured apt to retain its cache and consistently used the --no-install-recommends flag to prevent installing unnecessary packages, minimizing image size.
  • Improved FFmpeg Reliability: Added MD5 checksum validation to the FFmpeg download process to ensure integrity.
  • Refined Package Lists: Removed unused packages and added essential ones like gpg-agent to ensure build reliability.
  • Configuration: Added .mise.toml to .gitignore.

Validation

Manual testing was done. Further testing is requested to verify impact and functionality, particularly in differing and constrained environments such as CI/CD pipelines.

Description generated by Mesa. Update settings

Copy link
Contributor

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

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

one question otherwise looks awesome. Thanks @matthewjmarangoni!

@matthewjmarangoni
Copy link
Contributor Author

Caching can be used to help builds continue to run if a resource is offline and having just experienced an outage of the ffmpeg provider blocking builds, relevant changes have been added. The builds will use the existing archive from the cache if the checksum request times out, allowing the build to continue.

Also cleaned up a straggler that was removing index metadata.

@matthewjmarangoni matthewjmarangoni force-pushed the upd-space-and-time branch 2 times, most recently from 1e8213e to d66de84 Compare August 28, 2025 23:47
@matthewjmarangoni
Copy link
Contributor Author

Changing the locking mechanism for apt caches supports multiple writers and yields some time reduction.

@matthewjmarangoni matthewjmarangoni marked this pull request as ready for review August 29, 2025 16:35
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 330685e...0a438f7

6 files reviewed | 0 comments | Review on Mesa | Edit Reviewer Settings

@matthewjmarangoni matthewjmarangoni marked this pull request as draft August 29, 2025 23:26
@matthewjmarangoni matthewjmarangoni marked this pull request as ready for review September 9, 2025 20:47
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 330685e...2d40710

Tip

⚡ Quick Actions

This review was generated by Mesa.

Actions:

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

6 files reviewed | 6 comments | Review on Mesa | Edit Reviewer Settings

cursor[bot]

This comment was marked as outdated.

@matthewjmarangoni matthewjmarangoni marked this pull request as draft September 9, 2025 21:27
@rgarcia
Copy link
Contributor

rgarcia commented Sep 9, 2025

@matthewjmarangoni let me know when you want another review! Would like to get this one over the finish line

@matthewjmarangoni matthewjmarangoni marked this pull request as ready for review September 10, 2025 14:15
Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 330685e...992f8fd

Tip

⚡ Quick Actions

This review was generated by Mesa.

Actions:

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

6 files reviewed | 6 comments | Review on Mesa | Edit Reviewer Settings

cursor[bot]

This comment was marked as outdated.

@matthewjmarangoni
Copy link
Contributor Author

@matthewjmarangoni let me know when you want another review! Would like to get this one over the finish line

@rgarcia as long as that answer for the previous question you had was sufficient, it should be ready now that other issues have been resolved!

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

Performed full review of 330685e...992f8fd

Tip

⚡ Quick Actions

This review was generated by Mesa.

Actions:

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

6 files reviewed | 7 comments | Review on Mesa | Edit Reviewer Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants