-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.sh
38 lines (28 loc) · 847 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
#!/bin/sh
echo "Start run entrypoint script..."
echo "Database:" $DATABASE
if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
while ! psql -h $BBDD_HOST -U $POSTGRES_USER -d $POSTGRES_DB
do
echo "Waiting for PostgreSQL..."
sleep 0.5
done
echo "PostgreSQL started"
fi
echo "Enviroment:" $APP_ENV
if [ "$APP_ENV" = "local" ]; then
echo "Start create database"
flask create-db
echo "Done create database"
echo "Start check user-admin"
flask create-user-admin
echo "Done init user-admin"
echo "Run app with gunicorn server..."
gunicorn -c ./gunicorn/gunicorn_config.py $API_ENTRYPOINT;
fi
if [ "$APP_ENV" = "production" ]; then
echo "Run app with gunicorn server..."
gunicorn --bind $API_HOST:$API_PORT $API_ENTRYPOINT --timeout 10 --workers 4;
fi