From 55a019d2178ac7798f8a1f5f47eb22a3e0fd621f Mon Sep 17 00:00:00 2001 From: henningxtro Date: Wed, 7 Apr 2021 23:34:08 +0200 Subject: [PATCH] BETTERZON-49 (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BETTERZON-49: Creating Dockerfile * BETTERZON-49: Added minimal Flask API as Docker container Co-authored-by: Patrick Müller --- Crawler/Crawler.iml | 6 ++++++ Crawler/Dockerfile | 20 ++++++++++++++++++++ Crawler/api.py | 16 ++++++++++++++++ Crawler/requirements.txt | 3 +++ Frontend/src/app/app.module.ts | 2 +- 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Crawler/Dockerfile create mode 100644 Crawler/api.py diff --git a/Crawler/Crawler.iml b/Crawler/Crawler.iml index 80cc739..db1dd1c 100644 --- a/Crawler/Crawler.iml +++ b/Crawler/Crawler.iml @@ -1,8 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/Crawler/Dockerfile b/Crawler/Dockerfile new file mode 100644 index 0000000..1fa49c2 --- /dev/null +++ b/Crawler/Dockerfile @@ -0,0 +1,20 @@ +# Base image +FROM python + +# Create directories and copy files +RUN echo 'Creating directory and copying files' +RUN mkdir /crawler +ADD . /crawler +WORKDIR /crawler + +# Install dependencies +RUN echo 'Installing dependencies' +RUN pip install -r requirements.txt + +# Expose ports +RUN echo 'Exposing ports' +EXPOSE 22026 + +# Start API +RUN echo 'Starting API' +CMD ["python3", "api.py"] diff --git a/Crawler/api.py b/Crawler/api.py new file mode 100644 index 0000000..b28ba1b --- /dev/null +++ b/Crawler/api.py @@ -0,0 +1,16 @@ +from flask import Flask +from flask_restful import Resource, Api + +app = Flask(__name__) +api = Api(app) + + +class CrawlerApi(Resource): + def get(self): + return {'Hallo': 'Betterzon'} + + +api.add_resource(CrawlerApi, '/') + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=22026) diff --git a/Crawler/requirements.txt b/Crawler/requirements.txt index d4a7eda..04ca272 100644 --- a/Crawler/requirements.txt +++ b/Crawler/requirements.txt @@ -1 +1,4 @@ pymysql +flask +flask-sqlalchemy +flask_restful \ No newline at end of file diff --git a/Frontend/src/app/app.module.ts b/Frontend/src/app/app.module.ts index f9508f9..45105ca 100644 --- a/Frontend/src/app/app.module.ts +++ b/Frontend/src/app/app.module.ts @@ -48,7 +48,7 @@ const cookieConfig: NgcCookieConsentConfig = { }, content: { // Custom message - //message: 'By using our site, you acknowledge that you have read and understand our ', + // message: 'By using our site, you acknowledge that you have read and understand our ', whatAreCookiesLink: 'Learn more', whatAreCookiesHref: 'https://www.cookiesandyou.com/',