-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·26 lines (20 loc) · 748 Bytes
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·26 lines (20 loc) · 748 Bytes
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
#!/bin/sh
if [ -z $(id sarna 2>/dev/null) ]; then
echo "sarna:x:3000:3000:sarna:/sarna:/bin/sh" >>/etc/passwd
echo "sarna:x:3000:" >>/etc/group
fi
chown sarna:sarna /sarna/uploaded_data /sarna/static
DATABASE_HOST=$(echo $SQLALCHEMY_DATABASE_URI | sed -r 's#\w+://[^:]+:[^@]+@([^/]+)/.*#\1#')
until nc -z -v -w30 $DATABASE_HOST 5432; do
echo "Waiting for database connection..."
# wait for 5 seconds before check again
sleep 5
done
flask db upgrade 9ab3158991e2 2>/dev/null
su -c 'flask db upgrade' sarna
su -c 'flask assets build' sarna
if [ "$FLASK_ENV" == "development" ]; then
su -c 'flask run --debugger --host 0.0.0.0' sarna
else
su -c 'gunicorn -w 4 -b 0.0.0.0:5000 --access-logfile - --error-logfile - app:app' sarna
fi