forked from harperreed/google-home-notifier-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notify.sh
executable file
·69 lines (54 loc) · 997 Bytes
/
notify.sh
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
#!/bin/bash
BASEDIR=$(dirname $0)
cd $BASEDIR
IMAGE_NAME="harperreed/notifier"
CONTAINER_NAME=notifier
ACTION=$1
if [ -z "$ACTION" ];
then
echo "usage: $0 <build|run|stop|start|remove|rerun|attach|push|logs|debug>";
exit 1;
fi
# Build
_build() {
docker build --tag="$IMAGE_NAME" .
}
# Run (first time)
_run() {
docker run -d --name $CONTAINER_NAME --net=host $IMAGE_NAME
}
# Debugging mode with terminal access
_debug() {
docker run -i -t --entrypoint /bin/bash --name $CONTAINER_NAME --net=host $IMAGE_NAME
}
# Stop
_stop() {
docker stop $CONTAINER_NAME
}
# Start (after stopping)
_start() {
docker start $CONTAINER_NAME
}
# Remove
_remove() {
docker rm $CONTAINER_NAME
}
# Remove container and create a new one
_rerun() {
_stop
_remove
_run
}
# Manually open bash
_attach() {
docker exec -ti $CONTAINER_NAME /bin/bash
}
# Container logs
_logs() {
docker logs $CONTAINER_NAME
}
# Publish contents
_push() {
docker push $IMAGE_NAME
}
eval _$ACTION