From e23f20d287acb0ea11a0ac2656a8b6efaade2fb6 Mon Sep 17 00:00:00 2001 From: Bee Webb Date: Wed, 6 Nov 2024 15:45:47 +0000 Subject: [PATCH] Dockerfile: run dynamic django agpp using gunicorn --- .dockerignore | 2 ++ Dockerfile | 6 +++++- requirements.in | 3 ++- requirements.txt | 8 ++++++-- requirements_dev.txt | 3 +++ 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..7a451343f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +data +out diff --git a/Dockerfile b/Dockerfile index 623da6f29..fc8b288d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.12-bookworm -WORKDIR /work +WORKDIR /work/IATI-Dashboard/dashboard COPY requirements.txt /work/IATI-Dashboard/requirements.txt @@ -8,6 +8,8 @@ RUN git config --global --add safe.directory /work/IATI-Stats/data RUN pip install -r /work/IATI-Dashboard/requirements.txt +COPY . /work/IATI-Dashboard + # 2024-03-20: Emergency fix # We were seeing cert errors inside the docker container after a new Lets Encrypt was issued. # @@ -17,3 +19,5 @@ RUN pip install -r /work/IATI-Dashboard/requirements.txt # I tried installing the LE root cert's manually but that didn't work. # As live is broken for now we need this emergency fix, but we should remove it in the future. RUN echo "check_certificate=off" > /root/.wgetrc + +CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--timeout", "120", "ui.wsgi:application"] diff --git a/requirements.in b/requirements.in index 523b2f0a4..488212fa8 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,5 @@ django +gunicorn flask frozen-flask jinja2 @@ -11,4 +12,4 @@ lxml requests markupsafe itsdangerous -tqdm \ No newline at end of file +tqdm diff --git a/requirements.txt b/requirements.txt index afde658de..cb1e9ed6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile requirements.in +# pip-compile # asgiref==3.8.1 # via django @@ -30,6 +30,8 @@ fonttools==4.54.1 # via matplotlib frozen-flask==1.0.2 # via -r requirements.in +gunicorn==23.0.0 + # via -r requirements.in idna==3.10 # via requests itsdangerous==2.2.0 @@ -56,7 +58,9 @@ numpy==2.1.1 # contourpy # matplotlib packaging==24.1 - # via matplotlib + # via + # gunicorn + # matplotlib pillow==10.4.0 # via matplotlib pyparsing==3.1.4 diff --git a/requirements_dev.txt b/requirements_dev.txt index 480e11b87..32fbe21f0 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -58,6 +58,8 @@ fonttools==4.54.1 # matplotlib frozen-flask==1.0.2 # via -r requirements.txt +gunicorn==23.0.0 + # via -r requirements.txt idna==3.10 # via # -r requirements.txt @@ -95,6 +97,7 @@ numpy==2.1.1 packaging==24.1 # via # -r requirements.txt + # gunicorn # matplotlib # pytest pillow==10.4.0