From 2e94ab1584e9d7d092a0eaf2bde35fd17bb50e0c Mon Sep 17 00:00:00 2001 From: Aaron Louie Date: Fri, 22 May 2020 14:55:55 -0400 Subject: [PATCH] Only runs upgrade if env variable says to. --- Dockerfile | 1 - docker_run.sh | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index fae1657f..fc86ddb0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ RUN pip install pipenv && \ COPY . /app/ ENV FLASK_APP=/app/crc/__init__.py -CMD ["pipenv", "run", "flask", "db", "upgrade"] CMD ["pipenv", "run", "python", "/app/run.py"] # expose ports diff --git a/docker_run.sh b/docker_run.sh index 95792392..1ff01c11 100755 --- a/docker_run.sh +++ b/docker_run.sh @@ -3,17 +3,15 @@ # run migrations export FLASK_APP=./crc/__init__.py -for entry in ./instance/* ; do - echo "$entry" - cat $entry -done - if [ "$DOWNGRADE_DB" = "true" ]; then - echo 'Downgrading...' + echo 'Downgrading database...' pipenv run flask db downgrade fi -pipenv run flask db upgrade +if [ "$UPGRADE_DB" = "true" ]; then + echo 'Upgrading database...' + pipenv run flask db upgrade +fi if [ "$RESET_DB" = "true" ]; then echo 'Resetting database...'