mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 11:24:19 +00:00
[CLI] avoid configure twice (#171)
* avoid configure twice * cleanup tmp config * update output msg * address comment * update msg * script update
This commit is contained in:
parent
06db9213b1
commit
62d266f018
3 changed files with 23 additions and 9 deletions
|
@ -137,10 +137,16 @@ class StackBuild(Subcommand):
|
||||||
if build_config.image_type == "conda"
|
if build_config.image_type == "conda"
|
||||||
else (f"llamastack-{build_config.name}")
|
else (f"llamastack-{build_config.name}")
|
||||||
)
|
)
|
||||||
|
if build_config.image_type == "conda":
|
||||||
cprint(
|
cprint(
|
||||||
f"You can now run `llama stack configure {configure_name}`",
|
f"You can now run `llama stack configure {configure_name}`",
|
||||||
color="green",
|
color="green",
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
cprint(
|
||||||
|
f"You can now run `llama stack run {build_config.name}`",
|
||||||
|
color="green",
|
||||||
|
)
|
||||||
|
|
||||||
def _run_template_list_cmd(self, args: argparse.Namespace) -> None:
|
def _run_template_list_cmd(self, args: argparse.Namespace) -> None:
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -8,15 +8,17 @@ from enum import Enum
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
from llama_stack.distribution.utils.exec import run_with_pty
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack.distribution.utils.exec import run_with_pty
|
|
||||||
|
|
||||||
from llama_stack.distribution.datatypes import * # noqa: F403
|
from llama_stack.distribution.datatypes import * # noqa: F403
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from llama_stack.distribution.distribution import api_providers, SERVER_DEPENDENCIES
|
||||||
|
from llama_stack.distribution.utils.config_dirs import BUILDS_BASE_DIR
|
||||||
from llama_stack.distribution.distribution import get_provider_registry
|
from llama_stack.distribution.distribution import get_provider_registry
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +97,7 @@ def build_image(build_config: BuildConfig, build_file_path: Path):
|
||||||
build_config.name,
|
build_config.name,
|
||||||
package_deps.docker_image,
|
package_deps.docker_image,
|
||||||
str(build_file_path),
|
str(build_file_path),
|
||||||
|
str(BUILDS_BASE_DIR / ImageType.docker.value),
|
||||||
" ".join(deps),
|
" ".join(deps),
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$#" -lt 4 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
special_pip_deps="$5"
|
special_pip_deps="$6"
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ build_name="$1"
|
||||||
image_name="llamastack-$build_name"
|
image_name="llamastack-$build_name"
|
||||||
docker_base=$2
|
docker_base=$2
|
||||||
build_file_path=$3
|
build_file_path=$3
|
||||||
pip_dependencies=$4
|
host_build_dir=$4
|
||||||
|
pip_dependencies=$5
|
||||||
|
|
||||||
# Define color codes
|
# Define color codes
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
@ -33,7 +34,8 @@ REPO_CONFIGS_DIR="$REPO_DIR/tmp/configs"
|
||||||
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
|
||||||
llama stack configure $build_file_path --output-dir $REPO_CONFIGS_DIR
|
llama stack configure $build_file_path
|
||||||
|
cp $host_build_dir/$build_name-run.yaml $REPO_CONFIGS_DIR
|
||||||
|
|
||||||
add_to_docker() {
|
add_to_docker() {
|
||||||
local input
|
local input
|
||||||
|
@ -132,6 +134,9 @@ fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
$DOCKER_BINARY build $DOCKER_OPTS -t $image_name -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
$DOCKER_BINARY build $DOCKER_OPTS -t $image_name -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
||||||
|
|
||||||
|
# clean up tmp/configs
|
||||||
|
rm -rf $REPO_CONFIGS_DIR
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
echo "Success! You can run it with: $DOCKER_BINARY $DOCKER_OPTS run -p 5000:5000 $image_name"
|
echo "Success! You can run it with: $DOCKER_BINARY $DOCKER_OPTS run -p 5000:5000 $image_name"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue