feat: export distribution container build artifacts

Add a new --export-dir flag to the `llama stack build` command that
allows users to export container build artifacts to a specified
directory instead of building the container directly. This feature is
useful for:

- Building containers in different environments
- Sharing build configurations
- Customizing the build process

The exported tarball includes:
- Containerfile (Dockerfile)
- Run configuration file (if building from config)
- External provider files (if specified)
- Build script for assistance

The tarball is named with a timestamp for uniqueness: <distro-name>_<timestamp>.tar.gz

Documentation has been updated in building_distro.md to reflect this new
functionality as well as integration tests.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-05-16 11:37:56 +02:00
parent 047303e339
commit e9bcb0e827
No known key found for this signature in database
7 changed files with 186 additions and 22 deletions

View file

@ -16,9 +16,10 @@ from llama_stack.distribution.utils.image_types import LlamaStackImageType
def test_container_build_passes_path(monkeypatch, tmp_path):
called_with = {}
def spy_build_image(cfg, build_file_path, image_name, template_or_config, run_config=None):
def spy_build_image(cfg, build_file_path, image_name, template_or_config, run_config=None, export_dir=None):
called_with["path"] = template_or_config
called_with["run_config"] = run_config
called_with["export_dir"] = export_dir
return 0
monkeypatch.setattr(