mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-30 01:24:16 +00:00
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:
parent
047303e339
commit
e9bcb0e827
7 changed files with 186 additions and 22 deletions
|
|
@ -93,6 +93,7 @@ def build_image(
|
|||
image_name: str,
|
||||
template_or_config: str,
|
||||
run_config: str | None = None,
|
||||
export_dir: str | None = None,
|
||||
):
|
||||
container_base = build_config.distribution_spec.container_image or "python:3.10-slim"
|
||||
|
||||
|
|
@ -108,11 +109,18 @@ def build_image(
|
|||
container_base,
|
||||
" ".join(normal_deps),
|
||||
]
|
||||
if export_dir is not None:
|
||||
args.append("--export-dir")
|
||||
args.append(f"{export_dir}")
|
||||
|
||||
# When building from a config file (not a template), include the run config path in the
|
||||
# build arguments
|
||||
if run_config is not None:
|
||||
args.append(run_config)
|
||||
|
||||
if special_deps:
|
||||
args.append("--special-pip-deps")
|
||||
# The content is added after all the image_type conditions
|
||||
elif build_config.image_type == LlamaStackImageType.CONDA.value:
|
||||
script = str(importlib.resources.files("llama_stack") / "distribution/build_conda_env.sh")
|
||||
args = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue