2020-11-13 04:27:41 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2021-06-10 09:33:49 +00:00
|
|
|
# Absolute path to the toplevel milvus directory.
|
2020-11-13 04:27:41 +00:00
|
|
|
toplevel=$(dirname "$(cd "$(dirname "${0}")"; pwd)")
|
|
|
|
|
2023-08-18 10:32:19 +00:00
|
|
|
if [[ -f "$toplevel/.env" ]]; then
|
2023-12-25 02:28:47 +00:00
|
|
|
set -a # automatically export all variables from .env
|
|
|
|
source $toplevel/.env
|
|
|
|
set +a # stop automatically exporting
|
2023-08-18 10:32:19 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-13 04:27:41 +00:00
|
|
|
pushd "${toplevel}"
|
|
|
|
|
2021-04-29 03:28:27 +00:00
|
|
|
if [[ "${1-}" == "pull" ]]; then
|
2021-07-08 07:43:45 +00:00
|
|
|
docker-compose pull --ignore-pull-failures builder
|
2020-11-13 04:27:41 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2021-04-29 03:28:27 +00:00
|
|
|
if [[ "${1-}" == "down" ]]; then
|
2020-11-18 08:38:28 +00:00
|
|
|
docker-compose down
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2023-08-29 11:10:28 +00:00
|
|
|
PLATFORM_ARCH="${PLATFORM_ARCH:-${IMAGE_ARCH}}"
|
|
|
|
|
|
|
|
export IMAGE_ARCH=${PLATFORM_ARCH}
|
|
|
|
|
2023-08-18 10:32:19 +00:00
|
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-ccache"
|
|
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-go-mod"
|
|
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-vscode-extensions"
|
|
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/${IMAGE_ARCH}-${OS_NAME}-conan"
|
2020-11-13 04:27:41 +00:00
|
|
|
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"
|
|
|
|
|
2021-07-08 07:43:45 +00:00
|
|
|
docker-compose pull --ignore-pull-failures builder
|
2023-08-21 01:54:20 +00:00
|
|
|
if [[ "${CHECK_BUILDER:-}" == "1" ]]; then
|
2021-07-08 07:43:45 +00:00
|
|
|
docker-compose build builder
|
2020-11-17 10:36:03 +00:00
|
|
|
fi
|
2021-04-29 03:28:27 +00:00
|
|
|
|
2023-08-18 10:32:19 +00:00
|
|
|
docker-compose run --no-deps --rm builder "$@"
|
2020-11-13 04:27:41 +00:00
|
|
|
|
|
|
|
popd
|