-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsnowbox_run
executable file
·50 lines (44 loc) · 1.34 KB
/
snowbox_run
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
#!/bin/bash
# POSIX
attach=0
while :; do
case $1 in
-a|-\?|--attach)
attach=1
;;
-?*)
printf 'Warning: Unknown option: %s\n' "$1" >&2
;;
*) #default case: no more options
break
esac
shift
done
./mktestenvconfig || exit 1
. testenv_config
if [ "$attach" -eq "0" ]; then
docker rm snow_test 2> /dev/null
if [ $? -ne 0 ]; then
printf 'Container already exists. Trying to attach...\n'
docker exec -it --privileged snow_test /bin/bash 2> /dev/null
if [ $? -ne 0 ]; then
printf 'Creating new container.\n'
docker run --name snow_test -p 8080:8080 -p 8000:8000 -p 6060:6060 \
-p 8443:8443 \
-it -v ${SNOWFLAKE_REPO}:/go/src/snowflake -v \
${SNOWFLAKEWEB_REPO}:/go/src/snowflake-webext \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined snowbox \
/bin/bash
fi
exit
else
docker run --name snow_test -p 8080:8080 -p 8000:8000 -p 6060:6060 \
-p 8443:8443 \
-it -v ${SNOWFLAKE_REPO}:/go/src/snowflake -v \
${SNOWFLAKEWEB_REPO}:/go/src/snowflake-webext \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined snowbox \
/bin/bash
exit
fi
fi
docker exec -it snow_test /bin/bash