-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpublish.sh
executable file
·40 lines (34 loc) · 958 Bytes
/
publish.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
#!/bin/bash
GIT_PATH=/home/stt/prod/bot
SITE_PATH=/home/stt/prod/sitebuild
DATA_PATH=/home/stt/prod/data
pushd $GIT_PATH
git pull 2>&1
if [ $? -ne 0 ]
then
echo "Failed during git pull"
exit 1
fi
# TODO: versioning?
docker build --tag stt-datacore/bot:latest .
if [ $? -ne 0 ]
then
echo "Failed during Docker build"
exit 3
fi
popd
# TODO: remove old image and restart; is there a best practices for this?
docker stop DCBot
docker rm DCBot
docker run -d --name=DCBot \
--restart unless-stopped \
--net=host \
--mount type=bind,source="$DATA_PATH",target=/data \
--mount type=bind,source="$SITE_PATH",target=/sitedata \
--env PROFILE_DATA_PATH=/data/profiles \
--env DB_CONNECTION_STRING=sqlite:/data/datacore.db \
--env DC_DATA_PATH=/sitedata/public/structured \
--env CONFIG_PATH=/data/bot_config.json \
--env LOG_PATH=/data/logs/ \
--env-file "$DATA_PATH/env.list" \
stt-datacore/bot:latest