Files
librechat-custom/Dockerfile
T

58 lines
4.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Inference Co-op LibreChat — brand overlay on the official Cloudron package
#
# Build: cloudron builder build --repository registry.inference.coop/co-op/librechat-custom --tag <yyyymmdd>-<gitsha>
# Deploy: cloudron update --app <app-id> --image registry.inference.coop/co-op/librechat-custom:<tag>
# (run from THIS directory — the CLI reads CloudronManifest.json here)
#
# Rules that keep this image safe:
# 1. The base tag is PINNED to the exact appstore image the app runs
# (manifest.dockerImage). Never a floating tag: a rebuild must never
# silently pull a newer LibreChat than the one we validated.
# 2. CloudronManifest.json keeps the OFFICIAL appstore addons block
# (postgresql, mongodb, oidc, sendmail, localstorage) — never remove or
# hand-edit those, or the app crash-loops (mkdir: Read-only file system).
# The ONLY field we change is `dockerImage`, repointed to the overlay tag
# built from this repo on every deploy (the base FROM stays the appstore
# image we validated). A stale dockerImage pin silently redeploys an old
# build — that is what broke the sandbox on 2026-10-18/19.
# 3. This image changes ONLY static brand assets. All behavior lives on the
# persistent volume (/app/data/librechat.yaml, /app/data/env,
# /app/data/mcp/) and survives image updates unchanged.
FROM cloudron/ai.librechat.cloudronapp:202610150224320000
# Login-page + header logo (the client bundle references assets/logo.svg)
COPY assets/logo.svg /app/code/librechat/client/dist/assets/logo.svg
# Browser favicons + PWA icons (referenced by dist/index.html + manifest.webmanifest)
COPY assets/favicon-32x32.png /app/code/librechat/client/dist/assets/favicon-32x32.png
COPY assets/favicon-16x16.png /app/code/librechat/client/dist/assets/favicon-16x16.png
COPY assets/apple-touch-icon-180x180.png /app/code/librechat/client/dist/assets/apple-touch-icon-180x180.png
COPY assets/icon-192x192.png /app/code/librechat/client/dist/assets/icon-192x192.png
COPY assets/maskable-icon.png /app/code/librechat/client/dist/assets/maskable-icon.png
# Figtree font (design kit, SIL OFL) — self-hosted, matches homepage/dashboard
COPY assets/fonts/ /app/code/librechat/client/dist/assets/fonts/
# Custom stylesheet and optional helper JS
COPY assets/custom.css /app/code/librechat/client/dist/assets/custom.css
# rebuild trigger
COPY assets/custom2.js /app/code/librechat/client/dist/assets/custom2.js
# Co-op UI strings: rename the "MCP Servers" button to "Tools" and replace
# the LibreChat footer tagline with the co-op footer. Non-fatal at build.
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
# 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|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
# PWA chrome colors: LibreChat ships a teal theme_color (#009688) in the web
# manifest (the bright green bar Firefox PWAs draw across the top) and black
# background_color. Point both at the cream page color; the index.html meta
# gets a light + dark pair so browser tabs match the theme too.
RUN sed -i 's|"theme_color": "#009688"|"theme_color": "#faf8f5"|; s|"background_color": "#000000"|"background_color": "#faf8f5"|' /app/code/librechat/client/dist/manifest.webmanifest && \
sed -i 's|<meta name="theme-color" content="#171717" />|<meta name="theme-color" media="(prefers-color-scheme: light)" content="#faf8f5" />\n <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#22271f" />|' /app/code/librechat/client/dist/index.html