This milestone of the deployment project consists of “Dockerizing” a web application developed in Python following all the best practices (security and Dockerfile development) seen in the class.
All the application code is in the flask-app folder.
The application starts on port 8000 (even if you work in class, test it at home since in the lab it will probably be closed or put one that lets you test it locally by changing the port in the .py).
The application dependencies are in the requirements.txt file.
To test that the application container starts and works correctly,
create a container based on the image you made with your Dockerfile and expose port 8000.
port 8000. When accessing with the browser you should see:
When
Translated with DeepL Translate: The world's most accurate translator (free version)
I need flask 1.0.2 is a class exercise.
I managed to do it with this
app.py
import os
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html");
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8000, debug=True)
docker_compse.yml
FROM python:3.10
WORKDIR \app
COPY..
run pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
dockerfile
FROM python:3.10
WORKDIR /Dockerpython
COPY . .
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
requirements.txt
Flask==1.0.2
tengo también una carpeta de un index.html que muestra una foto
este es el ejercicio… el conseguido hacerlo con el flask 2.2.2