Skip to content

Commit 6d533e0

Browse files
committed
fix(docker): declare /romm as single volume to enable asset hardlinks
PR #3388 added hardlink-based asset import/export (os.link with a shutil.copy2 fallback) to avoid duplicating disk space. The Dockerfile VOLUME instruction listed each /romm subdirectory (resources, library, assets, config, sync) separately, which makes Docker create an independent mount point for each one — even when the user bind-mounts a single parent at /romm. Each mount point is its own st_dev, so every cross-directory os.link() failed with EXDEV and silently fell back to a full copy, defeating the optimization. Declare the parent /romm directory instead so all subdirectories share a single filesystem and hardlinks can succeed when paths reside on the same underlying host filesystem.
1 parent 84d4bf1 commit 6d533e0

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

docker/Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,17 @@ ENV PYTHONDONTWRITEBYTECODE=1
216216
ENV PYTHONUNBUFFERED=1
217217
ENV PYTHONPATH=/backend
218218

219-
# Declare the supported volumes
220-
VOLUME ["/romm/resources", "/romm/library", "/romm/assets", "/romm/config", "/romm/sync", "/redis-data"]
219+
# Declare the supported volumes.
220+
#
221+
# We declare the parent `/romm` directory rather than each of its
222+
# subdirectories (resources, library, assets, config, sync) individually.
223+
# Listing the subdirectories causes Docker to create a separate mount point
224+
# (its own `st_dev`) for each one, even when the user bind-mounts a single
225+
# parent directory at `/romm`. That makes every cross-directory `os.link()`
226+
# fail with EXDEV ("Cross-device link"), forcing the asset import/export
227+
# hardlink optimization to fall back to a full copy. Declaring only `/romm`
228+
# keeps the subdirectories on a single filesystem so hardlinks can succeed.
229+
VOLUME ["/romm", "/redis-data"]
221230

222231
# Expose non-privileged ports
223232
EXPOSE 8080 6379/tcp

0 commit comments

Comments
 (0)