forked from phoenix-oss/llama-stack-mirror
Update docker build flow a little
This commit is contained in:
parent
5bed6c276c
commit
afae4e3d8e
2 changed files with 11 additions and 8 deletions
|
@ -82,12 +82,13 @@ class StackBuild(Subcommand):
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from llama_stack.distribution.distribution import get_provider_registry
|
|
||||||
from prompt_toolkit import prompt
|
from prompt_toolkit import prompt
|
||||||
from prompt_toolkit.completion import WordCompleter
|
from prompt_toolkit.completion import WordCompleter
|
||||||
from prompt_toolkit.validation import Validator
|
from prompt_toolkit.validation import Validator
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
|
from llama_stack.distribution.distribution import get_provider_registry
|
||||||
|
|
||||||
if args.list_templates:
|
if args.list_templates:
|
||||||
self._run_template_list_cmd(args)
|
self._run_template_list_cmd(args)
|
||||||
return
|
return
|
||||||
|
@ -201,6 +202,7 @@ class StackBuild(Subcommand):
|
||||||
self.parser.error(f"Could not parse config file {args.config}: {e}")
|
self.parser.error(f"Could not parse config file {args.config}: {e}")
|
||||||
return
|
return
|
||||||
self._run_stack_build_command_from_build_config(build_config)
|
self._run_stack_build_command_from_build_config(build_config)
|
||||||
|
|
||||||
def _get_build_config_from_name(self, args: argparse.Namespace) -> Optional[Path]:
|
def _get_build_config_from_name(self, args: argparse.Namespace) -> Optional[Path]:
|
||||||
if os.getenv("CONDA_PREFIX", ""):
|
if os.getenv("CONDA_PREFIX", ""):
|
||||||
conda_dir = (
|
conda_dir = (
|
||||||
|
@ -227,11 +229,11 @@ class StackBuild(Subcommand):
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack.distribution.build import build_image, ImageType
|
from llama_stack.distribution.build import build_image, ImageType
|
||||||
from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
|
from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR
|
||||||
from llama_stack.distribution.utils.serialize import EnumEncoder
|
from llama_stack.distribution.utils.serialize import EnumEncoder
|
||||||
from termcolor import cprint
|
|
||||||
|
|
||||||
# save build.yaml spec for building same distribution again
|
# save build.yaml spec for building same distribution again
|
||||||
if build_config.image_type == ImageType.docker.value:
|
if build_config.image_type == ImageType.docker.value:
|
||||||
|
@ -266,7 +268,7 @@ class StackBuild(Subcommand):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
cprint(
|
cprint(
|
||||||
f"You can now run `llama stack run {build_config.name}`",
|
f"You can now edit your run.yaml file and run `docker run -it -p 5000:5000 {build_config.name}`. See full command in llama-stack/distributions/",
|
||||||
color="green",
|
color="green",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -296,4 +298,3 @@ class StackBuild(Subcommand):
|
||||||
headers,
|
headers,
|
||||||
separate_rows=True,
|
separate_rows=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
|
# the root directory of this source tree.
|
||||||
|
|
||||||
LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-}
|
LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-}
|
||||||
LLAMA_STACK_DIR=${LLAMA_STACK_DIR:-}
|
LLAMA_STACK_DIR=${LLAMA_STACK_DIR:-}
|
||||||
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
||||||
|
@ -34,9 +40,6 @@ REPO_CONFIGS_DIR="$REPO_DIR/tmp/configs"
|
||||||
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
|
||||||
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
|
||||||
output_file="$TEMP_DIR/Dockerfile"
|
output_file="$TEMP_DIR/Dockerfile"
|
||||||
|
@ -113,7 +116,6 @@ ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server"]
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
add_to_docker "ADD tmp/configs/$(basename "$build_file_path") ./llamastack-build.yaml"
|
add_to_docker "ADD tmp/configs/$(basename "$build_file_path") ./llamastack-build.yaml"
|
||||||
add_to_docker "ADD tmp/configs/$build_name-run.yaml ./llamastack-run.yaml"
|
|
||||||
|
|
||||||
printf "Dockerfile created successfully in $TEMP_DIR/Dockerfile"
|
printf "Dockerfile created successfully in $TEMP_DIR/Dockerfile"
|
||||||
cat $TEMP_DIR/Dockerfile
|
cat $TEMP_DIR/Dockerfile
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue