From 66c9bff57e7fcc194e939e097df4da3b1dbfce3e Mon Sep 17 00:00:00 2001 From: P-O Quirion Date: Tue, 10 Sep 2024 16:39:48 -0400 Subject: [PATCH] optional alembic update in Containerfile --- Containerfile | 4 ++-- entrypoint.sh | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Containerfile b/Containerfile index 786af59..62b6172 100644 --- a/Containerfile +++ b/Containerfile @@ -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"] diff --git a/entrypoint.sh b/entrypoint.sh index 51b59e3..91d1d7e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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()" "${@}"