From dfaa2c1f024367aa7b524a60ae2dec876e965c00 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Tue, 2 Jan 2024 21:55:29 +0100 Subject: [PATCH] remove rich from docker build --- nginx/Dockerfile | 1 - nginx/masz-svelte/hashbuild.py | 28 ++++++++++++---------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index eb9d1aa23..109d5d07f 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -7,7 +7,6 @@ RUN npm install RUN npm run build RUN apt update && apt install -y python3-pip -RUN python3 -m pip install rich RUN python3 hashbuild.py FROM nginx:alpine diff --git a/nginx/masz-svelte/hashbuild.py b/nginx/masz-svelte/hashbuild.py index 23192850d..59fb44fc5 100644 --- a/nginx/masz-svelte/hashbuild.py +++ b/nginx/masz-svelte/hashbuild.py @@ -1,15 +1,11 @@ import hashlib import shutil -from rich.console import Console - # generate hash based on file content above def generate_hash(file_content: str): return hashlib.sha256(file_content.encode("utf-8")).hexdigest() -console = Console() - with open("public/index.html") as fh: index_html = fh.read() @@ -25,7 +21,7 @@ def generate_hash(file_content: str): with open("public/build/bundle.css") as fh: bundle_css = fh.read() -console.log("Generating hashes...") +print("Generating hashes...") LANGUAGES = [ "en", @@ -48,15 +44,15 @@ def generate_hash(file_content: str): main_js_map_hash = generate_hash(main_js_map) bundle_css_hash = generate_hash(bundle_css) -console.log("Generated hashes:") -console.log(f"global_css: {global_css_hash}") -console.log(f"main_js: {main_js_hash}") -console.log(f"main_js_map: {main_js_map_hash}") -console.log(f"bundle_css: {bundle_css_hash}") +print("Generated hashes:") +print(f"global_css: {global_css_hash}") +print(f"main_js: {main_js_hash}") +print(f"main_js_map: {main_js_map_hash}") +print(f"bundle_css: {bundle_css_hash}") for lang in languages_hashes: - console.log(f"{lang}.json: {languages_hashes[lang]}") + print(f"{lang}.json: {languages_hashes[lang]}") -console.log("Writing hashes to index.html...") +print("Writing hashes to index.html...") index_html = index_html.replace( "global.css", f"global-{global_css_hash}.css" @@ -71,7 +67,7 @@ def generate_hash(file_content: str): with open("public/index.html", "w") as fh: fh.write(index_html) -console.log("Writing hashes to bundle.js and bundle.js.map ...") +print("Writing hashes to bundle.js and bundle.js.map ...") for lang in languages_hashes: main_js = main_js.replace( f"/i18n/{lang}.json", f"/i18n/{lang}-{languages_hashes[lang]}.json" @@ -89,7 +85,7 @@ def generate_hash(file_content: str): with open("public/build/bundle.js.map", "w") as fh: fh.write(main_js_map) -console.log("Moving files...") +print("Moving files...") shutil.move("public/global.css", f"public/global-{global_css_hash}.css") shutil.move("public/build/bundle.js", f"public/build/bundle-{main_js_hash}.js") @@ -98,6 +94,6 @@ def generate_hash(file_content: str): for lang in languages_hashes: shutil.move(f"public/i18n/{lang}.json", f"public/i18n/{lang}-{languages_hashes[lang]}.json") -console.log("Moved files.") +print("Moved files.") -console.log("Done!") +print("Done!")