Files
zpan/scripts/docker-entrypoint.sh
saltbo 0137f009d4 feat(docker): add deploy variants and auto-generate auth secret
- Add --external better-sqlite3 to tsup build to fix ESM runtime error
- Add docker-entrypoint.sh to auto-generate BETTER_AUTH_SECRET if not set
- Persist generated secret to /data/.auth_secret across restarts
- Move image-based compose files to deploy/ directory
- Add deploy/docker-compose.rustfs.yml for ZPan + RustFS setup
- Keep build-from-source docker-compose.yml at project root

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-21 10:41:24 -04:00

18 lines
497 B
Bash
Executable File

#!/bin/sh
set -e
# Auto-generate BETTER_AUTH_SECRET if not provided
if [ -z "$BETTER_AUTH_SECRET" ]; then
SECRET_FILE="/data/.auth_secret"
if [ -f "$SECRET_FILE" ]; then
BETTER_AUTH_SECRET=$(cat "$SECRET_FILE")
else
BETTER_AUTH_SECRET=$(node -e "console.log(require('crypto').randomBytes(32).toString('base64'))")
printf '%s' "$BETTER_AUTH_SECRET" > "$SECRET_FILE"
echo "Generated BETTER_AUTH_SECRET and saved to $SECRET_FILE"
fi
export BETTER_AUTH_SECRET
fi
exec "$@"