-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdockerctl.sh
More file actions
executable file
·57 lines (47 loc) · 1.03 KB
/
dockerctl.sh
File metadata and controls
executable file
·57 lines (47 loc) · 1.03 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
#!/bin/bash
function build {
docker build -t fablab/bookingbot .
}
function runwatch {
while inotifywait -e attrib ./*.p? ./tests/*.p?; do
docker stop bookingbot &> /dev/null
./dockerctl.sh &
done
}
COMMAND=${1:-run}
case $COMMAND in
run)
build
docker run --rm --name bookingbot fablab/bookingbot bot.pl
;;
watch)
build
runwatch
;;
debug)
build
docker run -it --rm --name bookingbot fablab/bookingbot -d bot.pl
;;
prove)
build
docker run --rm --name bookingbot --entrypoint prove fablab/bookingbot -l
;;
sh)
build
docker run -it --rm --name bookingbot --entrypoint /bin/bash fablab/bookingbot
;;
stop)
docker stop bookingbot
;;
*)
echo "Unknown command: $COMMAND" >&2
echo "Usage: $0 [command]" >&2
echo " run run bot (default)" >&2
echo " watch run bot and restart it each time source files changed" >&2
echo " debug run bot with debugger attached" >&2
echo " prove run tests" >&2
echo " sh run a shell in the container" >&2
echo " help show this help and exit" >&2
exit 1
;;
esac