-
Notifications
You must be signed in to change notification settings - Fork 1
/
start
executable file
·62 lines (53 loc) · 1.72 KB
/
start
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
#!/bin/bash
trap "echo -ne '\nstopping container...' && docker stop refinery-config > /dev/null 2>&1 && echo -ne '\t\t [done]\n'" EXIT
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) HOST_IP=$(ip a | grep "inet " | grep -v 127.0.0.1 | head -1 | grep -o -E "[0-9]+.[0-9]+.[0-9]+.[0-9]+" | head -1);;
Darwin*) HOST_IP=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | head -1 | grep -o -E "[0-9]+.[0-9]+.[0-9]+.[0-9]+" | head -1);;
esac
MINIO_ENDPOINT="http://$HOST_IP:7053"
HIDE_BUILD=0
while getopts :s flag
do
case "${flag}" in
s) HIDE_BUILD=1;;
esac
done
CONFIG_DIR=${PWD%/*}/dev-setup/config/
if [ ! -d "$CONFIG_DIR" ]
then
CONFIG_DIR=${PWD%/*/*}/dev-setup/config/
if [ ! -d "$CONFIG_DIR" ]
then
# to include volume for local development, use the dev-setup inference folder:
# alternative use manual logic with
# -v /path/to/dev-setup/config:/config \
echo "Can't find config directory: $CONFIG_DIR -> stopping"
exit 1
fi
fi
echo -ne 'stopping old container...'
docker stop refinery-config > /dev/null 2>&1
echo -ne '\t [done]\n'
echo -ne 'building container...'
if [ $HIDE_BUILD -eq 1 ]
then
docker build -t refinery-config-dev -f dev.Dockerfile . > /dev/null 2>&1
else
docker build -t refinery-config-dev -f dev.Dockerfile .
fi
echo -ne '\t [done]\n'
echo -ne 'starting...'
docker run -d --rm \
--name refinery-config \
-p 7059:80 \
-e KERN_S3_ENDPOINT=${MINIO_ENDPOINT} \
-e IS_MANAGED=0 \
-e IS_DEMO=0 \
--mount type=bind,source="$(pwd)"/,target=/app \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$CONFIG_DIR":/config \
--network dev-setup_default \
refinery-config-dev > /dev/null 2>&1
echo -ne '\t [done]\n'
docker logs -f refinery-config