| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # This source code is licensed under the terms described in the LICENSE file in |
| 7 | # the root directory of this source tree. |
| 8 | |
| 9 | DOCKER_BINARY=${DOCKER_BINARY:-docker} |
| 10 | DOCKER_OPTS=${DOCKER_OPTS:-} |
| 11 | |
| 12 | set -euo pipefail |
| 13 | |
| 14 | error_handler() { |
| 15 | echo "Error occurred in script at line: ${1}" >&2 |
| 16 | exit 1 |
| 17 | } |
| 18 | |
| 19 | trap 'error_handler ${LINENO}' ERR |
| 20 | |
| 21 | if [ $# -lt 2 ]; then |
| 22 | echo "Usage: $0 <container name> <build file path>" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | docker_image="$1" |
| 27 | host_build_dir="$2" |
| 28 | container_build_dir="/app/builds" |
| 29 | |
| 30 | set -x |
| 31 | $DOCKER_BINARY run $DOCKER_OPTS -it \ |
| 32 | -v $host_build_dir:$container_build_dir \ |
| 33 | $docker_image \ |
| 34 | llama stack configure ./llamastack-build.yaml --output-dir $container_build_dir |