From a5efb6acbce4631ff1aed6fe73999bd3c94fbc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 1 Jun 2026 18:22:44 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82?= =?UTF-8?q?=D1=83=D1=80=D0=B0=20=D0=BA=D0=B0=D0=BA=20=D1=83=20BG=20?= =?UTF-8?q?=E2=80=94=20class-based,=20debug=3DTrue,=20Dockerfile,=20=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D1=8B=D0=B9=20requirements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 12 ++++++++++++ requirements.txt | 2 -- site/app.py | 27 +++++++++++++++++---------- 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d83c3fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.12-slim + +WORKDIR /app + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +COPY site site + +EXPOSE 5000 + +CMD ["python", "site/app.py"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 13c011c..2e4f29c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,2 @@ Flask==2.0.1 Werkzeug==2.3.7 -requests>=2.31 -gunicorn>=21.2 diff --git a/site/app.py b/site/app.py index e607338..707edee 100644 --- a/site/app.py +++ b/site/app.py @@ -1,18 +1,25 @@ -from flask import Flask, jsonify, render_template - -app = Flask(__name__) +from flask import Flask, render_template, jsonify -@app.route("/") -def index(): - return render_template("index.html") +class SayApp: + def __init__(self): + self.app = Flask(__name__, template_folder="templates", static_folder="static") + self.add_routes() + def add_routes(self): + self.app.add_url_rule("/", "index", self.index) + self.app.add_url_rule("/health", "health", self.health) -@app.route("/health") -def health(): - return jsonify({"status": "ok"}) + def index(self): + return render_template("index.html") + + def health(self): + return jsonify({"status": "ok"}) + + def run(self): + self.app.run(host="0.0.0.0", port=5000, debug=True) if __name__ == "__main__": - app.run(host="0.0.0.0", port=5000) + SayApp().run()