Fix llama stack build docker creation to have correct entrypoint

This commit is contained in:
Ashwin Bharambe 2025-01-22 16:53:54 -08:00
parent 08dcb9e31e
commit a8345f5f76
2 changed files with 11 additions and 6 deletions

View file

@ -119,12 +119,15 @@ def build_image(
normal_deps += SERVER_DEPENDENCIES normal_deps += SERVER_DEPENDENCIES
if build_config.image_type == ImageType.container.value: if build_config.image_type == ImageType.container.value:
if not template_name:
raise ValueError("template_name is required for container builds")
script = str( script = str(
importlib.resources.files("llama_stack") / "distribution/build_container.sh" importlib.resources.files("llama_stack") / "distribution/build_container.sh"
) )
args = [ args = [
script, script,
image_name, template_name,
container_image, container_image,
str(build_file_path), str(build_file_path),
str(BUILDS_BASE_DIR / ImageType.container.value), str(BUILDS_BASE_DIR / ImageType.container.value),

View file

@ -12,9 +12,10 @@ TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
PYPI_VERSION=${PYPI_VERSION:-} PYPI_VERSION=${PYPI_VERSION:-}
BUILD_PLATFORM=${BUILD_PLATFORM:-} BUILD_PLATFORM=${BUILD_PLATFORM:-}
if [ "$#" -lt 4 ]; then if [ "$#" -lt 5 ]; then
echo "Usage: $0 <build_name> <container_base> <pip_dependencies> [<special_pip_deps>]" >&2 # This only works for templates
echo "Example: $0 my-fastapi-app python:3.9-slim 'fastapi uvicorn' " >&2 echo "Usage: $0 <template_name> <container_base> <pip_dependencies> <host_build_dir> [<special_pip_deps>]" >&2
echo "Example: $0 fireworks python:3.9-slim 'fastapi uvicorn' /path/to/build/dir" >&2
exit 1 exit 1
fi fi
@ -22,7 +23,7 @@ special_pip_deps="$6"
set -euo pipefail set -euo pipefail
build_name="$1" template_name="$1"
container_base=$2 container_base=$2
build_file_path=$3 build_file_path=$3
host_build_dir=$4 host_build_dir=$4
@ -151,7 +152,7 @@ add_to_container << EOF
# This would be good in production but for debugging flexibility lets not add it right now # This would be good in production but for debugging flexibility lets not add it right now
# We need a more solid production ready entrypoint.sh anyway # We need a more solid production ready entrypoint.sh anyway
# #
ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--template", "$build_name"] ENTRYPOINT ["python", "-m", "llama_stack.distribution.server.server", "--template", "$template_name"]
EOF EOF
@ -183,6 +184,7 @@ else
fi fi
# Add version tag to image name # Add version tag to image name
build_name="distribution-$template_name"
image_tag="$build_name:$version_tag" image_tag="$build_name:$version_tag"
# Detect platform architecture # Detect platform architecture