How to dockerize your Flask application
<h1>Introduction:</h1>
<p>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.</p>
<h1>A Simple Flask Application:</h1>
<p>The below code is a bare minimum flask application with a single end point <code>/hello</code>. Let’s say the module name is <code>my_flask.py</code>.</p>
<h2>my_flask.py</h2>
<pre>
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)</pre>
<p><a href="https://medium.com/geekculture/how-to-dockerize-your-flask-application-2d0487ecefb8"><strong>Visit Now</strong></a></p>
<p> </p>