From 5d238fcf3352f4fea0af785eac3c90fcc9ecdb25 Mon Sep 17 00:00:00 2001 From: Djeex Date: Thu, 21 Aug 2025 18:55:05 +0200 Subject: [PATCH] Version and docker OK --- Dockerfile | 3 +-- VERSION | 1 + docker/.sh/entrypoint.sh | 14 +++++++++++--- docker/docker-compose.yaml | 1 + src/py/builder/site_builder.py | 6 ++++-- src/py/webui/webui.py | 12 ++++++++++-- src/webui/gallery-editor/index.html | 2 +- src/webui/index.html | 2 +- src/webui/site-info/index.html | 2 +- src/webui/theme-editor/index.html | 2 +- 10 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 VERSION diff --git a/Dockerfile b/Dockerfile index f49cf44..4f9ba87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,8 @@ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +COPY build.py gallery.py VERSION /app/ COPY ./src/ ./src/ -COPY ./build.py ./build.py -COPY ./gallery.py ./gallery.py COPY ./config /app/default COPY ./docker/.sh/entrypoint.sh /app/entrypoint.sh RUN chmod +x /app/entrypoint.sh diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..359a5b9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.0.0 \ No newline at end of file diff --git a/docker/.sh/entrypoint.sh b/docker/.sh/entrypoint.sh index 5db76c5..77d9eb2 100644 --- a/docker/.sh/entrypoint.sh +++ b/docker/.sh/entrypoint.sh @@ -43,16 +43,24 @@ start_server() { cat /tmp/build_logs_fifo >&2 & cat /tmp/build_logs_fifo2 >&2 & - echo "Starting HTTP server on port 3000..." + echo "Starting preview HTTP server on port 3000..." python3 -u -m http.server 3000 -d /app/output & SERVER_PID=$! - trap "echo 'Stopping server...'; kill -TERM $SERVER_PID 2>/dev/null; wait $SERVER_PID; exit 0" SIGINT SIGTERM + + echo "Starting Lumeex Flask webui..." + python3 -u -m src.py.webui.webui & + WEBUI_PID=$! + + trap "echo 'Stopping servers...'; kill -TERM $SERVER_PID $WEBUI_PID 2>/dev/null; wait $SERVER_PID $WEBUI_PID; exit 0" SIGINT SIGTERM + wait $SERVER_PID + wait $WEBUI_PID } +VERSION=$(cat VERSION) if [ $# -eq 0 ]; then echo -e "${CYAN}╭───────────────────────────────────────────╮${NC}" - echo -e "${CYAN}│${NC} Lum${CYAN}eex${NC} - Version 1.3.1${NC} ${CYAN}│${NC}" + echo -e "${CYAN}│${NC} Lum${CYAN}eex${NC} - Version ${VERSION}${NC} ${CYAN}│${NC}" echo -e "${CYAN}├───────────────────────────────────────────┤${NC}" echo -e "${CYAN}│${NC} Source: https://git.djeex.fr/Djeex/lumeex ${CYAN}│${NC}" echo -e "${CYAN}│${NC} Mirror: https://github.com/Djeex/lumeex ${CYAN}│${NC}" diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index aab8432..0c76c42 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -7,4 +7,5 @@ services: - ../output:/app/output # mount output directory ports: - "3000:3000" + - "5005:5000" \ No newline at end of file diff --git a/src/py/builder/site_builder.py b/src/py/builder/site_builder.py index 10f38bf..9502ad6 100644 --- a/src/py/builder/site_builder.py +++ b/src/py/builder/site_builder.py @@ -21,12 +21,14 @@ STYLE_DIR = SRC_DIR / "src/public/style" GALLERY_FILE = SRC_DIR / "config/gallery.yaml" SITE_FILE = SRC_DIR / "config/site.yaml" THEMES_DIR = SRC_DIR / "config/themes" +VERSION_FILE = SRC_DIR / "VERSION" +with open(VERSION_FILE, "r") as vf: + build_version = vf.read().strip() def build(): - build_version = "v1.3.1" logging.info("\n") logging.info("=" * 24) - logging.info(f"🚀 Lumeex builder {build_version}") + logging.info(f"🚀 Lumeex builder v{build_version}") logging.info("=" * 24) logging.info("\n === Starting build === ") ensure_dir(BUILD_DIR) diff --git a/src/py/webui/webui.py b/src/py/webui/webui.py index bdeec5b..75969ac 100644 --- a/src/py/webui/webui.py +++ b/src/py/webui/webui.py @@ -18,6 +18,10 @@ from src.py.webui.upload import upload_bp logging.basicConfig(level=logging.INFO, format="%(message)s") # --- Flask app setup --- +VERSION_FILE = Path(__file__).resolve().parents[3] / "VERSION" +with open(VERSION_FILE, "r") as vf: + lumeex_version = vf.read().strip() + WEBUI_PATH = Path(__file__).parents[2] / "webui" # Path to static/templates app = Flask( __name__, @@ -68,6 +72,10 @@ def get_local_fonts(theme_name): def index(): return render_template("index.html") +@app.context_processor +def inject_version(): + return dict(lumeex_version=lumeex_version) + # --- Gallery & Hero API --- @app.route("/gallery-editor") def gallery_editor(): @@ -479,5 +487,5 @@ def download_output_zip(): # --- Run server --- if __name__ == "__main__": - logging.info("Starting WebUI at http://127.0.0.1:5000") - app.run(debug=True) \ No newline at end of file + logging.info("Starting WebUI at http://0.0.0.0:5000") + app.run(host="0.0.0.0", port=5000, debug=True) \ No newline at end of file diff --git a/src/webui/gallery-editor/index.html b/src/webui/gallery-editor/index.html index 2844f2a..4dae423 100644 --- a/src/webui/gallery-editor/index.html +++ b/src/webui/gallery-editor/index.html @@ -112,7 +112,7 @@