Вот файл Dcokerfile
Код: Выделить всё
FROM python:3.8.5-alpine3.12
WORKDIR /app
EXPOSE 8080
ENV FLASK_APP=app.py
COPY . /app
RUN pip install -r requirements.txt
ENTRYPOINT [ "flask"]
HEALTHCHECK --interval=10s --timeout=10s --start-period=55s \
CMD curl -f --retry 10 --max-time 15 --retry-delay 10 --retry-max-time 60 "http://localhost:8080/health" || exit 1
CMD [ "run", "--host", "0.0.0.0", "--port", "8080"]
Код: Выделить всё
$docker inspect --format '{{json .State.Health }}' flask-app
Template parsing error: template: :1:13: executing "" at : map has no entry for key "State"
Код: Выделить всё
from flask import Flask, request
from flask_restx import fields, Resource, Api, reqparse
app = Flask(__name__)
api = Api(app)
@api.route('/health', methods=['GET'])
class Health(Resource):
def get(self):
return { 'success': True, 'message': "healthy" }
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')


Подробнее здесь: https://stackoverflow.com/questions/675 ... -unhealthy
Мобильная версия