-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdo.sh
More file actions
71 lines (57 loc) · 1.37 KB
/
do.sh
File metadata and controls
71 lines (57 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# 2019 © Postgres.ai
set -x
install_gettext() {
if [[ "$OSTYPE" == "darwin"* ]]; then # Mac OSX
brew install gettext
brew link --force gettext
else # Linux
if [[ "$(command -v apk)" != "" ]]; then
apk add gettext
elif [[ "$(command -v apt-get)" != "" ]]; then
apt-get update
apt-get install gettext-base
fi
fi
}
subs_envs() {
rm -f $2
if [[ "$(command -v envsubst)" == "" ]]; then
install_gettext
fi
# Import additional envs from file specified in second arg.
if [ ! -z ${ENV+x} ]; then
source "./deploy/configs/${ENV}.sh"
fi
cat $1 | envsubst > $2
}
run_local() {
docker rm --force postgres-ai-local-docs
source ./deploy/configs/local.sh
docker build \
--tag postgres-ai-local/docs:dev \
--build-arg ARG_URL="${URL}" \
--build-arg ARG_BASE_URL="${BASE_URL}" \
--build-arg ARG_SIGN_IN_URL="${SIGN_IN_URL}" \
--build-arg ARG_BOT_WS_URL="${BOT_WS_URL}" \
--build-arg ARG_API_URL_PREFIX="${API_URL_PREFIX}"
.
docker run \
--name postgres-ai-local-docs \
--publish 3000:3000 \
postgres-ai-local/docs:dev
}
is_command_defined() {
type $1 2>/dev/null | grep -q 'is a function'
}
# Parse command and arguments.
COMMAND=$1
shift
ARGUMENTS=${@}
# Run command.
is_command_defined $COMMAND
if [ $? -eq 0 ]; then
$COMMAND $ARGUMENTS
else
echo "Command not found"
fi