OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

(enh) Docker runtime builder with BuildKit support, enh. caching

Open tobitege opened this issue 5 months ago • 2 comments

Short description of the problem this fixes or functionality that this introduces. This may be used for the CHANGELOG

Enhance Docker runtime builder with BuildKit support, improved caching, and better progress reporting.


Give a summary of what the PR does, explaining any non-trivial design decisions

Docker Runtime Builder Enhancements

This PR introduces several improvements to the Docker runtime builder, focusing on performance, logging, and error handling.

Key changes include:

  • Added back "Free Disk Space" action to nearly all workflows

  • Implemented BuildKit for improved build performance and caching (requires buildx in workflows wherever images are built from within OH)

  • Added support for local build cache (optional, default: False)

  • Enhanced progress output and logging, incl. "rolling logs" for atty-enabled terminals (not for logging to file)

  • Improved error handling and version compatibility checks

  • Added a couple of new unit tests for DockerRuntimeBuilder

Detailed Changes

DockerRuntimeBuilder Class

  • Added version check for Docker server (must be >= 18.09)
  • Method build now using BuildKit buildx via subprocess
  • Added support for local build cache (optional)
  • Improved progress output with real-time updates
  • Enhanced error handling for various build scenarios

Testing

  • Added new unit tests for DockerRuntimeBuilder
  • Implemented live Docker image fixture for testing (using small alpine base image)
  • Added tests for image building, existence checking, and cleanup

These changes aim to enhance the performance, reliability, and maintainability of the Docker runtime builder in the OpenHands project.

tobitege avatar Sep 23 '24 19:09 tobitege