From 9af48b4d2cff70586e63d18d236bfb09284f595d Mon Sep 17 00:00:00 2001 From: vmagelo Date: Mon, 24 Apr 2023 13:30:01 +0200 Subject: [PATCH] For container testing. --- .dockerignore | 3 +++ .gitignore | 1 + Dockerfile | 15 +++++++++++++++ gunicorn.conf.py | 14 ++++++++++++++ requirements.txt | 3 ++- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 gunicorn.conf.py diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ea7f2ce5e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git* +**/*.pyc +.venv/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index b6e47617d..f457acd23 100644 --- a/.gitignore +++ b/.gitignore @@ -104,6 +104,7 @@ celerybeat.pid # Environments .env .venv +.venvpy env/ venv/ ENV/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..7f1395846 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1 + +FROM python:3.11 + +WORKDIR /code + +COPY requirements.txt . + +RUN pip3 install -r requirements.txt + +COPY . . + +EXPOSE 50505 + +ENTRYPOINT ["gunicorn", "app:app"] \ No newline at end of file diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 000000000..fea6a15e4 --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,14 @@ +# Gunicorn configuration file +import multiprocessing + +max_requests = 1000 +max_requests_jitter = 50 + +log_file = "-" + +bind = "0.0.0.0:50505" + +workers = (multiprocessing.cpu_count() * 2) + 1 +threads = workers + +timeout = 120 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2db5aeaff..714f24eeb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -Flask==2.0.2 \ No newline at end of file +Flask==2.0.2 +gunicorn \ No newline at end of file