index.html branding via patch_index.py + per-build x-coop-build marker (SW self-heal); replaces fragile sed chain

This commit is contained in:
Nathan Schneider committed 2026-10-20 13:45:33 -06:00
1 parent 4b534fcaa2
commit 0468562aa0
2 files changed
+49 -5

No files matched your search

+6 -5
View File
@@ -41,12 +41,13 @@ COPY assets/custom2.js /app/code/librechat/client/dist/assets/custom2.js
COPY patch_ui_strings.py /app/code/patch_ui_strings.py
RUN python3 /app/code/patch_ui_strings.py
# Inject branding into built HTML (dist) before image is packaged
# Inject branding into built HTML (dist) before image is packaged.
# patch_index.py: title, custom.css/custom2.js links, and a per-build
# x-coop-build meta (unique every build → service worker precache revision
# changes → stale clients self-heal on deploy). Non-fatal at build.
# rebuild marker 20261019-$(date +%s)
RUN sed -i 's|<title>LibreChat</title>|<title>Inference Co‑op</title>|' /app/code/librechat/client/dist/index.html && \
sed -i '/<title>Inference Co‑op<\\/title>/a <link rel="stylesheet" href="assets/custom.css">' /app/code/librechat/client/dist/index.html && \
sed -i '/<link rel="stylesheet" href="assets\\/custom.css">/a <script src="assets/custom2.js"></script>' /app/code/librechat/client/dist/index.html && \
sed -i "s|</title>|</title>\\n <meta name=\"x-coop-build\" content=\"$(date +%s)\">|" /app/code/librechat/client/dist/index.html && \
COPY patch_index.py /app/code/patch_index.py
RUN python3 /app/code/patch_index.py && \
sed -i 's|assets/logo.svg|assets/logo.svg?v=3|g' /app/code/librechat/client/dist/assets/index.*.js && \
rm -f /app/code/librechat/client/dist/assets/index.*.js.gz /app/code/librechat/client/dist/assets/index.*.js.br