2024-02-19 04:57:24 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-10-13 15:08:40 +02:00
|
|
|
echo "Initializing Immich $IMMICH_SOURCE_REF"
|
|
|
|
|
2024-02-29 01:23:48 +02:00
|
|
|
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
|
|
|
|
export LD_PRELOAD="$lib_path"
|
|
|
|
|
2024-02-19 04:57:24 +02:00
|
|
|
read_file_and_export() {
|
|
|
|
if [ -n "${!1}" ]; then
|
|
|
|
content="$(cat "${!1}")"
|
|
|
|
export "$2"="${content}"
|
|
|
|
unset "$1"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
read_file_and_export "DB_URL_FILE" "DB_URL"
|
|
|
|
read_file_and_export "DB_HOSTNAME_FILE" "DB_HOSTNAME"
|
|
|
|
read_file_and_export "DB_DATABASE_NAME_FILE" "DB_DATABASE_NAME"
|
|
|
|
read_file_and_export "DB_USERNAME_FILE" "DB_USERNAME"
|
|
|
|
read_file_and_export "DB_PASSWORD_FILE" "DB_PASSWORD"
|
|
|
|
read_file_and_export "REDIS_PASSWORD_FILE" "REDIS_PASSWORD"
|
2023-07-15 17:30:52 +02:00
|
|
|
|
2024-06-05 12:45:53 +02:00
|
|
|
export CPU_CORES="${CPU_CORES:=$(./get-cpus.sh)}"
|
|
|
|
echo "Detected CPU Cores: $CPU_CORES"
|
|
|
|
if [ "$CPU_CORES" -gt 4 ]; then
|
|
|
|
export UV_THREADPOOL_SIZE=$CPU_CORES
|
|
|
|
fi
|
|
|
|
|
2024-02-19 01:03:01 +02:00
|
|
|
exec node /usr/src/app/dist/main "$@"
|