Only runs upgrade if env variable says to.

This commit is contained in:
Aaron Louie 2020-05-22 14:55:55 -04:00
parent b490005af7
commit 2e94ab1584
2 changed files with 5 additions and 8 deletions

View File

@ -17,7 +17,6 @@ RUN pip install pipenv && \
COPY . /app/ COPY . /app/
ENV FLASK_APP=/app/crc/__init__.py ENV FLASK_APP=/app/crc/__init__.py
CMD ["pipenv", "run", "flask", "db", "upgrade"]
CMD ["pipenv", "run", "python", "/app/run.py"] CMD ["pipenv", "run", "python", "/app/run.py"]
# expose ports # expose ports

View File

@ -3,17 +3,15 @@
# run migrations # run migrations
export FLASK_APP=./crc/__init__.py export FLASK_APP=./crc/__init__.py
for entry in ./instance/* ; do
echo "$entry"
cat $entry
done
if [ "$DOWNGRADE_DB" = "true" ]; then if [ "$DOWNGRADE_DB" = "true" ]; then
echo 'Downgrading...' echo 'Downgrading database...'
pipenv run flask db downgrade pipenv run flask db downgrade
fi 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 if [ "$RESET_DB" = "true" ]; then
echo 'Resetting database...' echo 'Resetting database...'