From 38e2459c7fb83803a7fbf7413de25ec408cd62bd Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 28 Feb 2023 11:59:37 +0000 Subject: [PATCH] new dockerfile with gunicorn and wsgi support --- application/Dockerfile | 4 ++-- application/requirements.txt | 1 + application/wsgi.py | 4 ++++ docker-compose.yaml | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 application/wsgi.py diff --git a/application/Dockerfile b/application/Dockerfile index d78aef1d..1e1e16ef 100644 --- a/application/Dockerfile +++ b/application/Dockerfile @@ -15,6 +15,6 @@ ENV FLASK_APP=app.py ENV FLASK_DEBUG=true RUN pip install -r requirements.txt -EXPOSE 5000 +EXPOSE 5001 -CMD ["flask", "run", "--host=0.0.0.0"] +CMD ["gunicorn", "-w", "6", "--bind", "0.0.0.0:5001", "wsgi:app"] diff --git a/application/requirements.txt b/application/requirements.txt index e0a9d3cf..46dfa129 100644 --- a/application/requirements.txt +++ b/application/requirements.txt @@ -25,6 +25,7 @@ filelock==3.9.0 Flask==2.2.2 frozenlist==1.3.3 greenlet==2.0.2 +gunicorn==20.1.0 h11==0.14.0 httpcore==0.16.3 httpx==0.23.3 diff --git a/application/wsgi.py b/application/wsgi.py new file mode 100644 index 00000000..11e7de6d --- /dev/null +++ b/application/wsgi.py @@ -0,0 +1,4 @@ +from app import app + +if __name__ == "__main__": + app.run() \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index cd54917d..f4b30fa9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,4 +9,5 @@ services: backend: build: ./application ports: - - "5001:5000" + - "5001:5001" +