From 73c58918a68766d407a77624192186f9ae2d208c Mon Sep 17 00:00:00 2001
From: Felix Delattre <fd@gfz-potsdam.de>
Date: Thu, 19 Aug 2021 08:20:23 +0000
Subject: [PATCH] Added initial Dockerfile for quart served by gunicorn

---
 Dockerfile             | 37 +++++++++++++++++++++++++++++++++++++
 files/supervisord.conf | 13 +++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 files/supervisord.conf

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a5bc5c5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,37 @@
+# Copyright (C) 2021:
+#  Deutsches GeoForschungsZentrum GFZ <https://www.gfz-potsdam.de>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+
+FROM debian:bullseye-slim
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get update -y && apt-get install --no-install-recommends -y \
+    python3-pip
+
+RUN pip3 install --upgrade \
+    wheel \
+    setuptools \
+    pip \
+    Quart \
+    gunicorn
+
+RUN pip3 install https://git.gfz-potsdam.de/dynamicexposure/openbuildingmap/data-api-server/-/archive/master/data-api-server-master.zip
+
+EXPOSE 5000
+VOLUME ["/srv/quart"]
+WORKDIR /srv/quart
+
+COPY ./files/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+CMD ["/usr/bin/supervisord"]
diff --git a/files/supervisord.conf b/files/supervisord.conf
new file mode 100644
index 0000000..0bd8551
--- /dev/null
+++ b/files/supervisord.conf
@@ -0,0 +1,13 @@
+[supervisord]
+nodaemon=true
+
+[program:quartweb]
+command=gunicorn --worker-class quart.worker.GunicornWorker -w 4 -b 0.0.0.0:5000 app:app
+directory=/srv/quart
+autostart=true
+autorestart=true
+startsecs=10
+startretries=3
+stdout_logfile=/dev/fd/1
+stdout_logfile_maxbytes=0
+redirect_stderr=true
-- 
GitLab