mirror of
https://github.com/immich-app/immich.git
synced 2024-11-30 09:47:31 +02:00
abf6fc25f7
* feat: automatically detect amount of CPU cores and allow overriding with CPU_CORES env var * chore: change default thumbnail concurrency to 3
27 lines
762 B
Bash
Executable File
27 lines
762 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
|
|
export LD_PRELOAD="$lib_path"
|
|
|
|
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"
|
|
|
|
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
|
|
|
|
exec node /usr/src/app/dist/main "$@"
|