BETTERZON-49 (#24)

* BETTERZON-49: Creating Dockerfile

* BETTERZON-49: Added minimal Flask API as Docker container

Co-authored-by: Patrick Müller <patrick@mueller-patrick.tech>
This commit is contained in:
henningxtro 2021-04-07 23:34:08 +02:00 committed by GitHub
parent 4d4a391f38
commit 55a019d217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 1 deletions

View File

@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python">
<configuration sdkName="Python 3.9 (venv)" />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.9 (venv) interpreter library" level="application" />
</component>
</module>

20
Crawler/Dockerfile Normal file
View File

@ -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"]

16
Crawler/api.py Normal file
View File

@ -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)

View File

@ -1 +1,4 @@
pymysql
flask
flask-sqlalchemy
flask_restful