-
Notifications
You must be signed in to change notification settings - Fork 1
/
robocorp-docker.sh
executable file
·65 lines (57 loc) · 1.59 KB
/
robocorp-docker.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
#!/bin/bash
DOCKER_COMPOSE_FILE="docker/docker-compose.yaml"
TOKEN_FILE="token.txt"
TOKEN_VAR=$(<"$TOKEN_FILE")
start() {
replicas=$1
echo "Executing command: RC_WORKER_LINK_TOKEN=$TOKEN_VAR docker compose -f \"$DOCKER_COMPOSE_FILE\" up -d --scale worker=\"$replicas\""
RC_WORKER_LINK_TOKEN=$TOKEN_VAR docker compose -f "$DOCKER_COMPOSE_FILE" up -d --scale worker="$replicas"
echo "Start command done."
}
stop() {
echo "Executing command: docker compose -f \"$DOCKER_COMPOSE_FILE\" down"
docker compose -f "$DOCKER_COMPOSE_FILE" down
echo "Stop command done."
}
status() {
echo "Executing command: docker compose -f \"$DOCKER_COMPOSE_FILE\" ps"
docker compose -f "$DOCKER_COMPOSE_FILE" ps
}
build() {
echo "Executing command: RC_WORKER_LINK_TOKEN=$TOKEN_VAR docker compose -f \"$DOCKER_COMPOSE_FILE\" build --no-cache"
RC_WORKER_LINK_TOKEN=$TOKEN_VAR docker compose -f "$DOCKER_COMPOSE_FILE" build --no-cache
echo "Build command done."
}
logs() {
echo "Executing command: docker compose -f \"$DOCKER_COMPOSE_FILE\" logs"
docker compose -f "$DOCKER_COMPOSE_FILE" logs
}
if [ $# -lt 1 ]; then
echo "Please specify a command: start, stop, status, build or logs."
exit 1
fi
case $1 in
start)
if [ $# -lt 2 ]; then
start 1
else
start "$2"
fi
;;
stop)
stop
;;
status)
status
;;
build)
build
;;
logs)
logs
;;
*)
echo "Invalid command. Please specify: start, stop, or status"
exit 1
;;
esac