Files
Bela/docker-entrypoint.sh
T
TMCandClaude Opus 5.5 2ab639cf12
Release / build (push) Successful in 4m41s
Docker: make a mounted /data folder writable whoever owns it
A host folder mounted on /data (owned by root, or by uid 1000) was not
writable for the server's uid 10001, so the rooms were not saved
("Permission denied"). The image now starts as root only to hand $DATA_DIR
to the bela user, then runs the server as bela via setpriv
(docker-entrypoint.sh). Started with another user (compose `user:`), it runs
as that user directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:53:25 +01:00

19 lines
674 B
Bash

#!/bin/sh
# Starts the Bela server as the unprivileged user bela (uid 10001).
#
# Started as root (the image default), it first hands $DATA_DIR to bela, so a host folder mounted on /data works
# whoever owns it on the host, then drops root. Started as another user (compose `user: "1000:1000"`), it runs
# as that user, and /data must be writable for it.
set -e
if [ "$(id -u)" = 0 ]; then
if [ -n "$DATA_DIR" ]; then
mkdir -p "$DATA_DIR"
chown -R bela:bela "$DATA_DIR"
fi
export HOME="$(getent passwd bela | cut -d: -f6)"
exec setpriv --reuid=bela --regid=bela --init-groups /app/server/bin/server "$@"
fi
exec /app/server/bin/server "$@"