mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-03 06:32:16 +00:00
Allow build with host network
This commit is contained in:
parent
78727aad26
commit
c01a89c0e8
3 changed files with 16 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-}
|
|||
LLAMA_STACK_DIR=${LLAMA_STACK_DIR:-}
|
||||
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
||||
BUILD_PLATFORM=${BUILD_PLATFORM:-}
|
||||
USE_HOST_NETWORK=${USE_HOST_NETWORK:-}
|
||||
|
||||
if [ "$#" -lt 4 ]; then
|
||||
echo "Usage: $0 <build_name> <docker_base> <pip_dependencies> [<special_pip_deps>]" >&2
|
||||
|
|
@ -163,14 +164,23 @@ if [ -n "$BUILD_PLATFORM" ]; then
|
|||
elif [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
|
||||
PLATFORM="--platform linux/arm64"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
# TODO: This is a hack, make the network host into a flag
|
||||
PLATFORM="--platform linux/amd64"
|
||||
else
|
||||
echo "Unsupported architecture: $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optionally add host network flag if requested.
|
||||
# Set USE_HOST_NETWORK=1 (or "true") in the environment to enable it.
|
||||
if [ "${USE_HOST_NETWORK:-}" = "1" ] || [ "${USE_HOST_NETWORK:-}" = "true" ]; then
|
||||
HOST_NETWORK="--network host"
|
||||
else
|
||||
HOST_NETWORK=""
|
||||
fi
|
||||
|
||||
set -x
|
||||
$DOCKER_BINARY build $DOCKER_OPTS $PLATFORM -t $image_tag -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
||||
$DOCKER_BINARY build $DOCKER_OPTS $PLATFORM $HOST_NETWORK -t $image_tag -f "$TEMP_DIR/Dockerfile" "$REPO_DIR" $mounts
|
||||
|
||||
# clean up tmp/configs
|
||||
set +x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue