cr-connect-workflow/docker_run.sh

35 lines
940 B
Bash
Raw Normal View History

#!/bin/bash
# run migrations
2020-05-25 04:47:49 +00:00
export FLASK_APP=/app/crc/__init__.py
2020-04-21 23:37:56 +00:00
if [ "$DOWNGRADE_DB" = "true" ]; then
echo 'Downgrading database...'
2020-04-21 23:37:56 +00:00
pipenv run flask db downgrade
fi
if [ "$UPGRADE_DB" = "true" ]; then
echo 'Upgrading database...'
pipenv run flask db upgrade
fi
2021-08-06 19:41:23 +00:00
if [ "$RESET_DB" = "true" ]; then
echo 'Resetting database and seeding it with example CR Connect data...'
pipenv run flask load-example-data
fi
2020-05-27 16:58:50 +00:00
if [ "$RESET_DB_RRT" = "true" ]; then
echo 'Resetting database and seeding it with example RRT data...'
pipenv run flask load-example-rrt-data
fi
# Assure that git doesn't flake out about a mounted volume
git config --global --add safe.directory /var/lib/cr-connect/specs
# THIS MUST BE THE LAST COMMAND!
2020-05-25 15:41:53 +00:00
if [ "$APPLICATION_ROOT" = "/" ]; then
2022-05-05 23:46:21 +00:00
exec pipenv run gunicorn --bind "0.0.0.0:$PORT0" wsgi:app
2020-05-25 15:41:53 +00:00
else
2022-05-05 23:46:21 +00:00
exec pipenv run gunicorn -e SCRIPT_NAME="$APPLICATION_ROOT" --bind "0.0.0.0:$PORT0" wsgi:app
2020-05-25 15:41:53 +00:00
fi