Skip to content

Commit

Permalink
optional alembic update in Containerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
poquirion committed Sep 10, 2024
1 parent 964c3f6 commit 66c9bff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ADD . $APP
# To be remove once the container is built from a release version instead of the tip of a branche
# It is a temporary hack to be able to keep hatch-vcs in the repo.
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0
RUN cd $APP && pip install .[postgres] && chmod 755 entrypoint.sh && mv entrypoint.sh ..
RUN cd $APP && pip install .[postgres] && chmod 755 entrypoint.sh

EXPOSE 8000

WORKDIR /app/$APP
ENTRYPOINT ["./entrypoint.sh", "-b", "0.0.0.0"]
CMD ["-w", "4"]
10 changes: 7 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ fi
DB_OPS=

if [[ -v "${C3G_SQLALCHEMY_DATABASE_URI}" ]]; then
DB_OPS=--db_uri ${C3G_SQLALCHEMY_DATABASE_URI}
DB_OPS=--db-uri ${C3G_SQLALCHEMY_DATABASE_URI}
fi

if [[ -v C3G_INIT_DB ]]; then
if [[ -v "${C3G_INIT_DB}" ]]; then
echo instanciating data base
flask --app $APP init-db $DB_OPS
fi
alembic upgrade head

if [[ -v "${C3G_ALEMBIC_UPGRADE}" ]]; then
alembic upgrade head
fi

gunicorn "project_tracking:create_app()" "${@}"

0 comments on commit 66c9bff

Please sign in to comment.