Add app sources and Dockerfile

This commit is contained in:
Ishak BELAHMAR 2023-02-12 12:12:33 +01:00
parent 2452396ec1
commit 7c2b45466e
4 changed files with 53 additions and 0 deletions

20
Dockerfile Normal file
View File

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

8
src/requirements.txt Normal file
View File

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

11
src/templates/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ma super app</title>
</head>
<body>
<h1>Ma super application</h1>
</body>
</html>

14
src/view.py Normal file
View File

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