Files
2026-07-13 13:39:12 +08:00

26 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -e
# ── Memory limit override ──────────────────────────────────────────────
# If OMNIROUTE_MEMORY_MB is set, build NODE_OPTIONS dynamically so the
# user can tune heap size via environment without editing the Dockerfile.
if [ -n "$OMNIROUTE_MEMORY_MB" ]; then
export NODE_OPTIONS="${NODE_OPTIONS:-} --max-old-space-size=${OMNIROUTE_MEMORY_MB}"
fi
DATA_PATH="${DATA_DIR:-/app/data}"
if [ -d "$DATA_PATH" ] && [ ! -w "$DATA_PATH" ]; then
echo "WARNING: $DATA_PATH is not writable by the current user (UID $(id -u))."
if [ "${CONTAINER_HOST:-}" = "podman" ]; then
echo "Rootless Podman maps container UIDs into a subordinate range."
echo "Run this on the host to fix (using the host-side bind-mount path):"
echo " podman unshare chown -R $(id -u):$(id -g) <host-data-dir>"
else
echo "Run this on the Docker host to fix (using the host-side bind-mount path):"
echo " sudo chown -R $(id -u):$(id -g) <host-data-dir>"
echo " chmod -R u+rwX <host-data-dir>"
fi
fi
exec "$@"