no need for dockerfiles

This commit is contained in:
Xi Yan 2025-01-14 15:36:46 -08:00
parent 0f21075575
commit 58d38ad3fa
2 changed files with 5 additions and 29 deletions

View file

@ -81,14 +81,6 @@ class StackBuild(Subcommand):
default="conda", default="conda",
) )
self.parser.add_argument(
"--dockerfile-only",
type=bool,
default=False,
action=argparse.BooleanOptionalAction,
help="Whether to generate a Dockerfile only (only valid when image-type is docker)",
)
def _run_stack_build_command(self, args: argparse.Namespace) -> None: def _run_stack_build_command(self, args: argparse.Namespace) -> None:
import textwrap import textwrap
@ -100,12 +92,6 @@ class StackBuild(Subcommand):
from llama_stack.distribution.distribution import get_provider_registry from llama_stack.distribution.distribution import get_provider_registry
if args.dockerfile_only and args.image_type != "docker":
self.parser.error(
"dockerfile-only flag is only valid when image-type is docker"
)
return
if args.list_templates: if args.list_templates:
self._run_template_list_cmd(args) self._run_template_list_cmd(args)
return return
@ -123,7 +109,6 @@ class StackBuild(Subcommand):
self._run_stack_build_command_from_build_config( self._run_stack_build_command_from_build_config(
build_config, build_config,
template_name=args.template, template_name=args.template,
dockerfile_only=args.dockerfile_only,
) )
return return
@ -195,7 +180,7 @@ class StackBuild(Subcommand):
name=name, image_type=image_type, distribution_spec=distribution_spec name=name, image_type=image_type, distribution_spec=distribution_spec
) )
self._run_stack_build_command_from_build_config( self._run_stack_build_command_from_build_config(
build_config, dockerfile_only=args.dockerfile_only build_config,
) )
return return
@ -206,7 +191,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( self._run_stack_build_command_from_build_config(
build_config, dockerfile_only=args.dockerfile_only build_config,
) )
def _generate_run_config(self, build_config: BuildConfig, build_dir: Path) -> None: def _generate_run_config(self, build_config: BuildConfig, build_dir: Path) -> None:
@ -284,7 +269,6 @@ class StackBuild(Subcommand):
self, self,
build_config: BuildConfig, build_config: BuildConfig,
template_name: Optional[str] = None, template_name: Optional[str] = None,
dockerfile_only: bool = False,
) -> None: ) -> None:
import json import json
import os import os
@ -304,7 +288,7 @@ class StackBuild(Subcommand):
to_write = json.loads(build_config.model_dump_json()) to_write = json.loads(build_config.model_dump_json())
f.write(yaml.dump(to_write, sort_keys=False)) f.write(yaml.dump(to_write, sort_keys=False))
return_code = build_image(build_config, build_file_path, dockerfile_only) return_code = build_image(build_config, build_file_path)
if return_code != 0: if return_code != 0:
return return

View file

@ -18,7 +18,7 @@ if [ "$#" -lt 4 ]; then
exit 1 exit 1
fi fi
special_pip_deps="$7" special_pip_deps="$6"
set -euo pipefail set -euo pipefail
@ -28,7 +28,6 @@ docker_base=$2
build_file_path=$3 build_file_path=$3
host_build_dir=$4 host_build_dir=$4
pip_dependencies=$5 pip_dependencies=$5
dockerfile_only=$6
# Define color codes # Define color codes
RED='\033[0;31m' RED='\033[0;31m'
@ -109,6 +108,7 @@ if [ -n "$LLAMA_STACK_DIR" ]; then
else else
if [ -n "$TEST_PYPI_VERSION" ]; then if [ -n "$TEST_PYPI_VERSION" ]; then
# these packages are damaged in test-pypi, so install them first # these packages are damaged in test-pypi, so install them first
echo "Installing fastapi libcst"
add_to_docker "RUN pip install fastapi libcst" add_to_docker "RUN pip install fastapi libcst"
add_to_docker <<EOF add_to_docker <<EOF
RUN pip install --no-cache --extra-index-url https://test.pypi.org/simple/ \ RUN pip install --no-cache --extra-index-url https://test.pypi.org/simple/ \
@ -176,14 +176,6 @@ fi
# Add version tag to image name # Add version tag to image name
image_tag="$image_name:$version_tag" image_tag="$image_name:$version_tag"
if [ "$dockerfile_only" = "True" ]; then
echo "Skipping docker build as dockerfile_only=True"
dockerfile_name="Dockerfile.${image_tag}"
cp "$TEMP_DIR/Dockerfile" "./${dockerfile_name}"
printf "Dockerfile saved to ./${dockerfile_name}\n\n"
exit 0
fi
# Detect platform architecture # Detect platform architecture
ARCH=$(uname -m) ARCH=$(uname -m)
if [ -n "$BUILD_PLATFORM" ]; then if [ -n "$BUILD_PLATFORM" ]; then