Browse Source

fix(docker): pin matplotlib cache to /tmp so the STL thumbnail generator stops logging EPERM

  Matplotlib (imported lazily by stl_thumbnail.py) tried to create its
  font/style cache at $HOME/.config/matplotlib on first STL upload.
  HOME=/app per the Dockerfile but /app is root-owned and not writable
  by the PUID:PGID the entrypoint drops to, so matplotlib logged
  "Permission denied" and fell back to /tmp/matplotlib-* — wiped on
  every restart, paying the font-scan cost again on the next STL.

  Add ENV MPLCONFIGDIR=/tmp/matplotlib to make the cache directory
  writable and persistent across the container's lifetime. /tmp is
  writable by any uid, so this works regardless of PUID.
maziggy 1 week ago
parent
commit
8e241915ae
2 changed files with 10 additions and 0 deletions
  1. 0 0
      CHANGELOG.md
  2. 10 0
      Dockerfile

File diff suppressed because it is too large
+ 0 - 0
CHANGELOG.md


+ 10 - 0
Dockerfile

@@ -121,6 +121,16 @@ ENV HOME=/app
 ENV USER=bambuddy
 ENV USER=bambuddy
 ENV LOGNAME=bambuddy
 ENV LOGNAME=bambuddy
 
 
+# Matplotlib (imported lazily by the STL thumbnail generator) tries to create
+# its font/style cache at $HOME/.config/matplotlib on first import. /app is
+# root-owned and not writable by the PUID:PGID the entrypoint drops to,
+# which trips an EPERM warning in everyone's logs and forces matplotlib
+# to fall back to a per-restart temp dir (paying the font-scan cost on
+# every container restart). Pinning the cache dir to /tmp/matplotlib
+# silences the warning and keeps the cache alive for the container's
+# lifetime. /tmp is writable by any uid, so this works regardless of PUID.
+ENV MPLCONFIGDIR=/tmp/matplotlib
+
 EXPOSE 322
 EXPOSE 322
 EXPOSE 990
 EXPOSE 990
 EXPOSE 3000
 EXPOSE 3000

Some files were not shown because too many files changed in this diff