-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.sh
executable file
·53 lines (39 loc) · 1.18 KB
/
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
#!/bin/bash
# TODO: look into sourcing port from rickybobby.yml
CURRENT_DIRECTORY=$(realpath $(dirname $0))
case $1 in
build)
docker build \
-t rickybobby . \
--network=host \
--build-arg UID=$(id -u ${USER}) \
--build-arg GID=$(id -g ${USER})
;;
# TODO: look into litestream for s3 backup
sync)
docker run \
-v $CURRENT_DIRECTORY/db:/home/eugene/rickybobby/db \
rickybobby /home/eugene/rickybobby/run.js sync
;;
web)
docker ps -aq --filter 'name=rickybobby-rest-api' | \
grep -q . && \
docker stop rickybobby-rest-api && \
docker rm -fv rickybobby-rest-api
docker run -t -d \
--name rickybobby-rest-api \
-p 3002:3001 \
-v $CURRENT_DIRECTORY/db:/home/eugene/rickybobby/db \
-v $CURRENT_DIRECTORY/rickybobby.yml:/home/eugene/rickybobby/rickybobby.yml \
rickybobby /home/eugene/rickybobby/run.js web
;;
shell)
docker run -it \
-p 3002:3001 \
-v $CURRENT_DIRECTORY/db:/home/eugene/rickybobby/db \
-v $CURRENT_DIRECTORY/rickybobby.yml:/home/eugene/rickybobby/rickybobby.yml \
rickybobby /bin/bash
;;
*)
echo "Unknown operation $1"
esac