Files
picpeak/backend
Paul Nothaft 103006132b fix(docker): make the all-in-one image work on a clean build and a bind mount (#1042)
Two bugs my first round of testing missed, both found by rebuilding from a
clean checkout and mounting a host directory instead of a named volume.

1. Bind mounts failed outright. The image creates /data/db, /data/storage and
   /data/logs at build time, and a named volume inherits that tree — but a
   bind-mounted host directory hides it, so chown ran against paths that did
   not exist and reported "the filesystem rejects chown". Misleading, and a
   dead end for exactly the NAS users this image targets. mkdir -p the roots
   before chowning them. The compose stack is unaffected: each of its three
   paths is its own mount point, so they always existed.

2. logger.js hard-coded <backend>/logs and ignored LOG_DIR entirely, so the
   variable the image sets was inert and the process died with EACCES on
   /app/logs — which this image, unlike backend/Dockerfile, never creates.
   logger.js now honours LOG_DIR, defaulting to the old path, so nothing
   changes for compose or native installs and the image's logs land on the
   volume as documented.

Why the first pass missed both: the earlier image was built from a worktree
where I had run wait-for-db.sh directly, which left a stray backend/logs that
COPY baked into the image. A clean checkout — i.e. CI, and every user — has no
such directory. Verified this time from a fresh worktree, both mount types.
2026-08-16 22:29:23 +02:00
..