-
Notifications
You must be signed in to change notification settings - Fork 25
/
entrypoint.sh
47 lines (37 loc) · 975 Bytes
/
entrypoint.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
#!/bin/bash
PUID=${PUID:-911}
PGID=${PGID:-911}
groupmod -o -g "$PGID" abc
usermod -o -u "$PUID" abc
echo "
-------------------------------------
User uid: $(id -u abc)
User gid: $(id -g abc)
-------------------------------------
"
# define default directories
LOGS_DIR=${LOGS_DIR:-"/data/logs"}
CONFIG_DIR=${CONFIG_DIR:-"/data/config"}
VIDEOS_DIR=${VIDEOS_DIR:-"/data/videos"}
TEMP_DIR=${TEMP_DIR:-"/data/temp"}
# set permissions
chown -R abc:abc ${LOGS_DIR}
chown -R abc:abc ${CONFIG_DIR}
chown -R abc:abc ${TEMP_DIR}
chown abc:abc ${VIDEOS_DIR}
# fonts
mkdir -p /var/cache/fontconfig
chown abc:abc /var/cache/fontconfig
gosu abc fc-cache -f
# dotnet envs
export DOTNET_BUNDLE_EXTRACT_BASE_DIR=/tmp
export FONTCONFIG_CACHE=/var/cache/fontconfig
# start api and worker as user abc
gosu abc /opt/app/ganymede-api &
api_pid=$!
# delay 5 seconds to wait for api to start
sleep 5
gosu abc /opt/app/ganymede-worker &
worker_pid=$!
# wait
wait $api_pid $worker_pid