Hello, World!
+Mode: {mode}
+Version: {version}
+diff --git a/hello-world/Dockerfile b/hello-world/Dockerfile index 0e7e56a..42b49dc 100644 --- a/hello-world/Dockerfile +++ b/hello-world/Dockerfile @@ -4,5 +4,6 @@ WORKDIR /app COPY hello-world/app.py . ENV FLASK_APP=app.py ENV FLASK_RUN_HOST=0.0.0.0 +HEALTHCHECK CMD curl --fail http://localhost:5000/healthz || exit 1 CMD ["flask", "run"] diff --git a/hello-world/app.py b/hello-world/app.py index 0bbe140..35a8868 100644 --- a/hello-world/app.py +++ b/hello-world/app.py @@ -1,8 +1,90 @@ -from flask import Flask +from pathlib import Path + +from flask import Flask, request app = Flask(__name__) +LIVE = Path("livez") +LIVE.write_text("ok") + @app.route("/") def hello_world(): - return "Hello, V2" + version = "v3" + if "5000" in request.base_url: + mode = "local" + header_color = "#a0dfa0" + elif "30001" in request.base_url: + mode = "active" + header_color = "#a0c0df" + elif "30002" in request.base_url: + mode = "preview" + header_color = "#dfa0df" + else: + mode = "unknown" + header_color = "#dfc0a0" + import time + + LIVE.write_text("no") + time.sleep(10) + LIVE.write_text("ok") + + return f""" + +
+Mode: {mode}
+Version: {version}
+