Files
Kaname/docker-entrypoint.sh
Pascal LinxweilerandClaude Opus 5.5 e73b019492 Deploy compose: shared DB bind mount, models on NFS
- deploy/compose.yaml: KANAME_DATA_DIR bind mount (SQLite) for web and
  worker, NFSv4 volume for models (worker only), configured via .env
- entrypoint fails fast with a chown hint if /data or /models isn't writable
- .env.example and README document the server storage layout

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 17:34:44 +02:00

30 lines
797 B
Bash

#!/bin/sh
# Usage: docker run <image> [web|worker|<any command>] (default: web)
set -e
role="${1:-web}"
require_writable() {
if ! touch "$1/.write-test" 2>/dev/null; then
echo "ERROR: $1 is not writable by uid $(id -u). On the host: chown -R $(id -u):$(id -g) <folder mounted at $1>" >&2
exit 1
fi
rm -f "$1/.write-test"
}
case "$role" in
web|worker)
echo "$role" > /tmp/kaname-role
require_writable /data
if [ "$role" = worker ]; then require_writable "${MODELS_DIR:-/models}"; fi
# web and worker usually start together; the lock makes sure only one runs the migrations.
flock /data/.migrate.lock node dist/migrate.mjs
;;
esac
case "$role" in
web) exec node_modules/.bin/next start ;;
worker) exec node dist/worker.mjs ;;
*) exec "$@" ;;
esac