mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 15:23:51 +00:00
build + run image seems to work
This commit is contained in:
parent
6f83187809
commit
a4af9675ac
2 changed files with 24 additions and 9 deletions
|
@ -1,20 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$#" -ne 4 ]; then
|
if [ "$#" -ne 3 ]; then
|
||||||
echo "Usage: $0 <image_name> <base_image> <pip_dependencies> <entrypoint_command>"
|
echo "Usage: $0 <image_name> <base_image> <pip_dependencies>
|
||||||
echo "Example: $0 my-fastapi-app python:3.9-slim 'fastapi uvicorn' 'python3 -m llama_toolchain.distribution.server --port 8000'"
|
echo "Example: $0 my-fastapi-app python:3.9-slim 'fastapi uvicorn'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IMAGE_NAME=$1
|
IMAGE_NAME=$1
|
||||||
BASE_IMAGE=$2
|
BASE_IMAGE=$2
|
||||||
PIP_DEPENDENCIES=$3
|
PIP_DEPENDENCIES=$3
|
||||||
ENTRYPOINT_COMMAND=$4
|
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
PORT=8001
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||||
SOURCE_DIR=$(dirname $(dirname "$SCRIPT_DIR"))
|
SOURCE_DIR=$(dirname $(dirname $(dirname "$SCRIPT_DIR")))
|
||||||
|
echo $SOURCE_DIR
|
||||||
|
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
echo "Created temporary directory: $TEMP_DIR"
|
echo "Created temporary directory: $TEMP_DIR"
|
||||||
|
@ -22,12 +24,14 @@ echo "Created temporary directory: $TEMP_DIR"
|
||||||
cat <<EOF >"$TEMP_DIR/Dockerfile"
|
cat <<EOF >"$TEMP_DIR/Dockerfile"
|
||||||
FROM $BASE_IMAGE
|
FROM $BASE_IMAGE
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY llama_toolchain /app
|
COPY llama-stack/llama_toolchain /app/llama_toolchain
|
||||||
|
COPY llama-models/models /app/llama_models
|
||||||
|
|
||||||
RUN pip install --no-cache-dir $PIP_DEPENDENCIES
|
RUN pip install $PIP_DEPENDENCIES
|
||||||
|
|
||||||
|
EXPOSE $PORT
|
||||||
|
ENTRYPOINT ["python3", "-m", "llama_toolchain.distribution.server", "--port", "$PORT"]
|
||||||
|
|
||||||
EXPOSE 8000
|
|
||||||
CMD $ENTRYPOINT_COMMAND
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "Dockerfile created successfully in $TEMP_DIR/Dockerfile"
|
echo "Dockerfile created successfully in $TEMP_DIR/Dockerfile"
|
||||||
|
|
11
llama_toolchain/distribution/run_image.sh
Normal file
11
llama_toolchain/distribution/run_image.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/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.
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
podman run -it -p 8001:8001 -v ~/.llama/test.yaml:/app/test.yaml test-image --yaml_config /app/test.yaml --disable-ipv6
|
Loading…
Add table
Add a link
Reference in a new issue