Files
spacedrive/apps/server/docker/entrypoint.sh
Vítor Vasconcellos cc94b57cb4 [ENG-1595] Fix some problems with the AI system (#2063)
* Fix some problems with the AI system
 - Fix downloading model using an internal rust string representation as path for the model file
 - Fix Linux loading onnx shared lib from a hardcoded path
 - Fix App should not crash when the AI system fails to start
 - Fix sd-server failing to start due to onnxruntime incorrect linking
 - Some extra clippy auto fixes

* Use latest ort

* Fix dangling sd_ai reference
 - Use entrypoint.sh to initilize container

* Fix server Dockerfile
 - Fix cargo warning

* Workaround intro video breaking onboarding for the web version

* Fix rebase
2024-02-12 17:45:17 +00:00

40 lines
1.0 KiB
Bash

#!/usr/bin/env sh
set -eu
# Shortcircuit for non-default commands.
# The last part inside the "{}" is a workaround for the following bug in ash/dash:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264
if [ -n "${1:-}" ] && [ "${1#-}" = "${1}" ] \
&& [ -n "$(command -v -- "${1}")" ] \
&& { ! [ -f "${1}" ] || [ -x "${1}" ]; }; then
exec "$@"
fi
if [ "$(id -u)" -ne 0 ]; then
echo "This container requires executing as root for initial setup, privilages are dropped after" 1>&2
exit 1
fi
echo "Configure unprivileged user"
addgroup --system --gid "${PGID}" spacedrive
adduser --system --disabled-password \
--uid "${PUID}" \
--home /var/empty \
--gecos 'Spacedrive system account' \
--ingroup spacedrive \
spacedrive
passwd -l spacedrive
if [ -n "${TZ:-}" ]; then
echo "Set Timezone to $TZ"
rm -f /etc/localtime
ln -s "/usr/share/zoneinfo/${TZ}" /etc/localtime
echo "$TZ" >/etc/timezone
fi
echo "Fix spacedrive's directories permissions"
chown -R "${PUID}:${PGID}" /data
exec su spacedrive -s /usr/bin/sd-server -- "$@"