From b56b2f106e68bda7ae23149c9272ae902ed244bd Mon Sep 17 00:00:00 2001 From: Gil Sousa Date: Thu, 7 Oct 2021 21:35:24 +0100 Subject: [PATCH 1/3] refactor(server.py): place app.run under top level code of the module This code ensures that the app run is only executed when we run the actual file --- server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index c8bc3c5..50beab1 100644 --- a/server.py +++ b/server.py @@ -68,4 +68,5 @@ def catch_all(u_path): response.headers['Access-Control-Allow-Origin'] = '*' return response -app.run(host='0.0.0.0') +if __name__ == '__main__': + app.run(host='0.0.0.0') From 8ee5665c81c722ee508e859724f2d64fde2ddea2 Mon Sep 17 00:00:00 2001 From: Gil Sousa Date: Thu, 7 Oct 2021 21:36:15 +0100 Subject: [PATCH 2/3] build(requirements.txt): create a file with the project required modules --- requirements.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4e2bc50 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +flask +requests +pytz +gspread +oauth2client +pysafebrowsing +validators From 82ac20c8fd1396fb9d254a643407bc3c389e6948 Mon Sep 17 00:00:00 2001 From: Gil Sousa Date: Thu, 7 Oct 2021 21:38:45 +0100 Subject: [PATCH 3/3] build: add docker support #1 --- Dockerfile | 12 ++++++++++++ Makefile | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4163cb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.5 + +COPY . . + +RUN pip install --upgrade pip +RUN pip install -r requirements.txt + +ENV FLASK_APP=server + +EXPOSE 5000 + +CMD flask run --host=0.0.0.0 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d148d17 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +build: + docker build -t 1pt-co . +run: + docker run -dp 5000:5000 1pt-co