-
Notifications
You must be signed in to change notification settings - Fork 252
/
Copy pathtwister-on-docker
executable file
·57 lines (46 loc) · 1.15 KB
/
twister-on-docker
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
#!/bin/sh
#
# Build or run a docker image of twister
#
ACTION=${1:-run}
MODE=${2:---local}
IMAGE_NAME=twister
REMOTE_IMAGE_NAME=miguelfreitas/twister
set -e
shift
case $ACTION in
build)
echo Building $IMAGE_NAME
docker build -t $IMAGE_NAME .
;;
run)
if [ "$MODE" = "--remote" ]; then
shift
IMAGE_NAME=$REMOTE_IMAGE_NAME
echo Pulling new version of $IMAGE_NAME
docker pull $IMAGE_NAME
fi
echo Running $IMAGE_NAME
docker run -d -p 28332:28332 -v $HOME/.twister:/root/.twister $IMAGE_NAME "$@"
echo "Twister should now be running at http://localhost:28332 (access with \"user\" / \"pwd\")"
;;
stop)
CID=$(docker ps | grep twister | awk '{print $1}')
if [ "$CID" ]; then
echo Stopping container $CID
docker stop $CID
docker rm $CID
fi
;;
*)
echo Usage:
echo " $0 run [ARGS FOR TWISTERD..]"
echo " Run twister from a local docker build (default)"
echo
echo " $0 run --remote [ARGS FOR TWISTERD..]"
echo " Run twister from the remote docker build at \"$REMOTE_IMAGE_NAME\""
echo
echo " $0 build"
echo " Build a local docker image for twister"
exit 2
esac