mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-22 14:23:57 +00:00
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:
parent
4d4a391f38
commit
55a019d217
|
@ -1,8 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="WEB_MODULE" version="4">
|
<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">
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="Python 3.9 (venv) interpreter library" level="application" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
20
Crawler/Dockerfile
Normal file
20
Crawler/Dockerfile
Normal 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
16
Crawler/api.py
Normal 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)
|
|
@ -1 +1,4 @@
|
||||||
pymysql
|
pymysql
|
||||||
|
flask
|
||||||
|
flask-sqlalchemy
|
||||||
|
flask_restful
|
Loading…
Reference in New Issue
Block a user