mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
9f4bb832b7
Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
51 lines
1.6 KiB
Bash
Executable File
51 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# Absolute path to the toplevel milvus directory.
|
|
toplevel=$(dirname "$(cd "$(dirname "${0}")"; pwd)")
|
|
|
|
pushd "${toplevel}"
|
|
|
|
if [[ "${1-}" == "pull" ]]; then
|
|
docker-compose pull --ignore-pull-failures ubuntu
|
|
# docker-compose pull --ignore-pull-failures gdbserver
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${1-}" == "down" ]]; then
|
|
docker-compose down
|
|
exit 0
|
|
fi
|
|
|
|
# Attempt to run in the container with the same UID/GID as we have on the host,
|
|
# as this results in the correct permissions on files created in the shared
|
|
# volumes. This isn't always possible, however, as IDs less than 100 are
|
|
# reserved by Debian, and IDs in the low 100s are dynamically assigned to
|
|
# various system users and groups. To be safe, if we see a UID/GID less than
|
|
# 500, promote it to 501. This is notably necessary on macOS Lion and later,
|
|
# where administrator accounts are created with a GID of 20. This solution is
|
|
# not foolproof, but it works well in practice.
|
|
uid=$(id -u)
|
|
gid=$(id -g)
|
|
[ "$uid" -lt 500 ] && uid=501
|
|
[ "$gid" -lt 500 ] && gid=$uid
|
|
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/amd64-ubuntu18.04-ccache"
|
|
mkdir -p "${DOCKER_VOLUME_DIRECTORY:-.docker}/amd64-ubuntu18.04-go-mod"
|
|
chmod -R 777 "${DOCKER_VOLUME_DIRECTORY:-.docker}"
|
|
|
|
docker-compose pull --ignore-pull-failures ubuntu
|
|
if [[ "${CHECK_BUILDER:-}" == "1" ]]; then
|
|
DATE_VERSION=latest docker-compose pull --ignore-pull-failures ubuntu
|
|
docker-compose build ubuntu
|
|
fi
|
|
|
|
if [[ "$(id -u)" != "0" ]]; then
|
|
docker-compose run --rm -u "$uid:$gid" ubuntu "$@"
|
|
else
|
|
docker-compose run --rm --entrypoint "/tini --" ubuntu "$@"
|
|
fi
|
|
|
|
popd
|