From 786040162beb9242c458665d12a87e21b2af0f52 Mon Sep 17 00:00:00 2001 From: LS Date: Fri, 4 Apr 2025 18:07:04 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20configura=20Flask=20para=20produ=C3=A7?= =?UTF-8?q?=C3=A3o=20com=20gunicorn=20e=20ajusta=20Dockerfile=20para=20Coo?= =?UTF-8?q?lify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 +++- app.py | 6 +++++- requirements.txt | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 35415af..8f59a3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,8 @@ EXPOSE 5000 # Definir o ambiente virtual como padrão ENV PATH="/venv/bin:$PATH" +ENV FLASK_APP=app.py +ENV FLASK_ENV=production # Comando para rodar a aplicação -CMD ["make", "run"] +CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] diff --git a/app.py b/app.py index de22e58..d97f0e3 100644 --- a/app.py +++ b/app.py @@ -1702,4 +1702,8 @@ def init_system(): if __name__ == '__main__': init_system() - app.run(debug=True) + app.run( + host='0.0.0.0', + port=5000, + debug=os.getenv('FLASK_ENV') == 'development' + ) diff --git a/requirements.txt b/requirements.txt index 898da9c..0b6d0f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ bcrypt==4.1.2 Bootstrap-Flask==2.3.3 flask-bootstrap5==0.1.dev1 PyJWT==2.8.0 +gunicorn==21.2.0