From 7c2b45466e11ebdfbbea19176c209f9af3ac6b1b Mon Sep 17 00:00:00 2001 From: Ishak BELAHMAR Date: Sun, 12 Feb 2023 12:12:33 +0100 Subject: [PATCH] Add app sources and Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ src/requirements.txt | 8 ++++++++ src/templates/index.html | 11 +++++++++++ src/view.py | 14 ++++++++++++++ 4 files changed, 53 insertions(+) create mode 100644 Dockerfile create mode 100644 src/requirements.txt create mode 100644 src/templates/index.html create mode 100644 src/view.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9a409be --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# start by pulling the python image +FROM python:3.8-alpine + +# copy the requirements file into the image +COPY ./src/requirements.txt /app/requirements.txt + +# switch working directory +WORKDIR /app + +# install the dependencies and packages in the requirements file +RUN pip install -r requirements.txt + +# copy every content from the local file to the image +COPY ./src/view.py /app/view.py +COPY ./src/templates /app/templates + +# configure the container to run in an executed manner +ENTRYPOINT [ "python" ] + +CMD ["view.py" ] diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..8ddfcf2 --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,8 @@ +click==8.0.3 +colorama==0.4.4 +Flask==2.0.2 +itsdangerous==2.0.1 +Jinja2==3.0.3 +MarkupSafe==2.0.1 +Werkzeug==2.0.2 +gunicorn==20.1.0 diff --git a/src/templates/index.html b/src/templates/index.html new file mode 100644 index 0000000..2f7cc7e --- /dev/null +++ b/src/templates/index.html @@ -0,0 +1,11 @@ + + + + + + Ma super app + + +

Ma super application

+ + diff --git a/src/view.py b/src/view.py new file mode 100644 index 0000000..2153d5c --- /dev/null +++ b/src/view.py @@ -0,0 +1,14 @@ +from flask import Flask, render_template +import os + +app = Flask(__name__) + + +@app.route('/') +def home(): + return render_template('index.html') + + +if __name__ == "__main__": + port = int(os.environ.get('PORT', 5000)) + app.run(debug=True, host='0.0.0.0', port=port)