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 new file mode 100644 index 000000000..fc8b288d9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.12-bookworm + +WORKDIR /work/IATI-Dashboard/dashboard + +COPY requirements.txt /work/IATI-Dashboard/requirements.txt + +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. +# +# We know there are changes coming about root certificates and the error may be caused by that: +# https://blog.cloudflare.com/upcoming-lets-encrypt-certificate-chain-change-and-impact-for-cloudflare-customers +# +# 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