From 9ab8111d09fcf0b24d297e0f83e07e4733670bbc Mon Sep 17 00:00:00 2001 From: Nuwan Samarasinghe Date: Wed, 14 Aug 2024 10:17:37 +0100 Subject: [PATCH] application startup fixes --- Dockerfile | 17 ++++++++++++----- app.py | 1 + app/__init__.py | 1 + app/{app.py => create_app.py} | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 app.py rename app/{app.py => create_app.py} (98%) diff --git a/Dockerfile b/Dockerfile index efbd8a9..a1d7d18 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,15 +5,22 @@ ############################################################################### FROM python:3.10-bullseye as fab-dev - +ARG USE_DEV_REQUIREMENTS WORKDIR /app -COPY . . -RUN apt-get update && apt-get install -y postgresql-client +COPY requirements.txt requirements.txt +COPY requirements-dev.txt requirements-dev.txt -RUN python3 -m pip install --upgrade pip && pip install pip-tools && pip install -r requirements.txt -RUN python3 -m pip install -r requirements-dev.txt +RUN if "$USE_DEV_REQUIREMENTS"; then \ + echo "Installing development dependencies..." && \ + python3 -m pip install --upgrade pip && pip install -r requirements-dev.txt; \ +else \ + echo "Installing production dependencies..." && \ + python3 -m pip install --upgrade pip && pip install -r requirements.txt; \ +fi + +COPY . . EXPOSE 8080 diff --git a/app.py b/app.py new file mode 100644 index 0000000..0adfc07 --- /dev/null +++ b/app.py @@ -0,0 +1 @@ +import app # noqa diff --git a/app/__init__.py b/app/__init__.py index e69de29..da4ca21 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -0,0 +1 @@ +from app.create_app import app # noqa \ No newline at end of file diff --git a/app/app.py b/app/create_app.py similarity index 98% rename from app/app.py rename to app/create_app.py index 1070c6e..ae6f83c 100644 --- a/app/app.py +++ b/app/create_app.py @@ -59,4 +59,4 @@ def create_app() -> Flask: return flask_app -app = create_app() +app = create_app() \ No newline at end of file