Introduction:
The objective of this post is to dockerise a minimalistic flask application. Let’s take an example of a simple flask program and dockerise it.
A Simple Flask Application:
The below code is a bare minimum flask application with a single end point /hello. Let’s say the module name is my_flask.py.
my_flask.py
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/hello", methods=["GET"])
def say_hello():
return jsonify({"msg": "Hello from Flask"})
if __name__ == "__main__":
# Please do not set debug=True in production
app.run(host="0.0.0.0", port=5000, debug=True)