75 lines
4.2 KiB
Docker
75 lines
4.2 KiB
Docker
# Patches two ERPNext branding hooks that have no Website Settings or any
|
|
# other DB-level override point — confirmed by reading boot.py's
|
|
# load_desktop_data() and sidebar.js's choose_app_name(): both read these
|
|
# directly from erpnext/hooks.py, per installed app, with no site-config
|
|
# layer in between.
|
|
#
|
|
# - app_title: renders literally as "ERPNext" directly under the
|
|
# workspace title in Desk's sidebar header, and as the Apps-switcher
|
|
# tile's label.
|
|
# - the erpnext-logo.svg references (app_logo_url, add_to_apps_screen's
|
|
# "logo" key, and website_context's splash_image fallback): the
|
|
# Apps-switcher tile's icon and a couple of erpnext-level branding
|
|
# fallbacks.
|
|
#
|
|
# Confirmed live: blanking app_title to "" isn't enough — boot.py's own
|
|
# fallback chain (`app_info.get("title") or hooks_value or app_name`)
|
|
# treats "" as falsy and falls through all the way to the raw app_name
|
|
# ("erpnext", lowercase). A single space is truthy, survives the fallback
|
|
# chain, and renders as blank — the same trick already used for Website
|
|
# Settings.footer_powered (see provision_client.py's _branding()).
|
|
#
|
|
# The logo points at /files/bettersight-logo.png rather than a new image
|
|
# asset baked in here — that file is uploaded per-site by
|
|
# playbook/provisioning/provision_client.py's _branding(), so this stays
|
|
# correct for every site on this bench without templating anything here.
|
|
#
|
|
# Wired in via frappe_docker's own CUSTOM_IMAGE/CUSTOM_TAG mechanism
|
|
# (compose.yaml: `${CUSTOM_IMAGE:-frappe/erpnext}:${CUSTOM_TAG:-$ERPNEXT_VERSION}`)
|
|
# — frappe_docker/ itself, and the root docker-compose.yml, are never
|
|
# touched for this. See build.sh.
|
|
#
|
|
# The grep checks below are load-bearing, not decoration: if a future
|
|
# ERPNEXT_VERSION bump rewords this file, the sed patterns silently no-op
|
|
# and this build fails loudly instead of shipping an unpatched image.
|
|
#
|
|
# Third patch: the Desk sidebar header's icon — top-left of every workspace
|
|
# page (e.g. "Stock"), a blue rounded-square box glyph. NOT reachable via
|
|
# Website Settings, erpnext/hooks.py, or any DB field: confirmed by reading
|
|
# sidebar_header.js's set_header_icon() and utils.js's get_desktop_icon() —
|
|
# for a workspace whose Desktop Icon record resolves to a real bundled SVG
|
|
# (ours does: apps/erpnext/erpnext/public/icons/desktop_icons/solid/stock.svg,
|
|
# 54x54, referenced by the DB's "Stock" Desktop Icon record via label match),
|
|
# that SVG always wins over any logo_url field, so the fix has to replace
|
|
# the SVG file itself rather than any DB value.
|
|
#
|
|
# stock-sidebar-icon.svg was pre-built on the host (same 54x54 viewBox as
|
|
# the original, our green box logo embedded via <image> so it inherits
|
|
# ERPNext's own dimensions exactly rather than guessing a size) — see the
|
|
# comment in that file's own generation for the source PNG. Patches only
|
|
# the "solid" variant, the one confirmed used by this exact spot; "subtle"
|
|
# (module/workspace grid cards) and the legacy un-varianted copy are left
|
|
# alone — extend this COPY to those two paths if consistency there is
|
|
# wanted too.
|
|
#
|
|
# Confirmed the hard way (checked before assuming): the SERVED copy at
|
|
# assets/erpnext/... looked at first like it might live in the `sites`
|
|
# volume needing a separate rebuild step — it doesn't. The entrypoint
|
|
# script symlinks sites/assets -> the image's own baked /assets on every
|
|
# container start, and assets/erpnext itself is a plain directory symlink
|
|
# straight back to apps/erpnext/erpnext/public (see
|
|
# `ls -la /home/frappe/frappe-bench/assets/` on any running container).
|
|
# So this COPY alone is sufficient — no rebuild, no extra step, and it's
|
|
# picked up immediately on container start.
|
|
|
|
ARG ERPNEXT_VERSION=v16.34.1
|
|
FROM frappe/erpnext:${ERPNEXT_VERSION}
|
|
|
|
COPY stock-sidebar-icon.svg apps/erpnext/erpnext/public/icons/desktop_icons/solid/stock.svg
|
|
|
|
RUN sed -i 's/^app_title = "ERPNext"$/app_title = " "/' apps/erpnext/erpnext/hooks.py \
|
|
&& sed -i 's|/assets/erpnext/images/erpnext-logo.svg|/files/bettersight-logo.png|g' apps/erpnext/erpnext/hooks.py \
|
|
&& grep -q '^app_title = " "$' apps/erpnext/erpnext/hooks.py \
|
|
&& [ "$(grep -c '/files/bettersight-logo.png' apps/erpnext/erpnext/hooks.py)" = "3" ] \
|
|
&& grep -q '<image href="data:image/png;base64,' apps/erpnext/erpnext/public/icons/desktop_icons/solid/stock.svg
|