Modify existing app to expose API for health check

Signed-off-by: Milan Pandurov <milanpandurov@pm.me>
This commit is contained in:
2025-02-16 16:09:18 +01:00
parent 0f9d819d2b
commit aace768660
2 changed files with 11 additions and 2 deletions

View File

@@ -2,4 +2,5 @@ FROM python:alpine3.17
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 9999
ENTRYPOINT ["python", "app.py"]

12
app.py
View File

@@ -1,9 +1,17 @@
from flask import Flask
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/alive', methods=['GET'])
def get_healthcheck():
response = {
"alive": True
}
return jsonify(response)
@app.route('/')
def hello_world():
return 'Hello World Python Program.'
return 'Health check application.'
if __name__ == "__main__":
app.run(host="0.0.0.0", port=9999)