push
This commit is contained in:
32
docker/entrypoint.sh
Executable file
32
docker/entrypoint.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
mkdir -p instance
|
||||
|
||||
export FLASK_APP=app.py
|
||||
|
||||
if [[ "${DATABASE_URL:-}" != "" ]]; then
|
||||
echo "[mikromon] waiting for database"
|
||||
python - <<'PY'
|
||||
import os, time
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
url = os.environ.get("DATABASE_URL")
|
||||
engine = create_engine(url, pool_pre_ping=True)
|
||||
for i in range(60):
|
||||
try:
|
||||
with engine.connect() as c:
|
||||
c.exec_driver_sql("SELECT 1")
|
||||
break
|
||||
except Exception:
|
||||
time.sleep(1)
|
||||
else:
|
||||
raise SystemExit("DB not reachable")
|
||||
PY
|
||||
fi
|
||||
|
||||
echo "[mikromon] applying migrations"
|
||||
MIKROMON_MIGRATING=1 flask db upgrade
|
||||
|
||||
echo "[mikromon] starting app"
|
||||
exec python app.py
|
||||
Reference in New Issue
Block a user