Update run.sh

This commit is contained in:
Alexandre
2022-07-10 08:00:31 +02:00
committed by GitHub
parent 702a422544
commit 5496551634

View File

@@ -6,13 +6,21 @@ sed -i "s|/usr/bin/with-contenv|/usr/bin/env|g" /etc/cont-init.d/*
LOCATION=/data
mkdir -p "$LOCATION"
touch "$LOCATION"/database.sqlite || true
chown -R wger "$LOCATION" || true
chmod -R 777 "$LOCATION" || true
if [ ! -f "$LOCATION"/database.sqlite ]; then
if [ -f "/home/wger/db/database.sqlite" ]; then
cp /home/wger/db/database.sqlite "$LOCATION"/database.sqlite
else
touch "$LOCATION"/database.sqlite
fi
fi
chown -R wger "$LOCATION"
chmod -R 777 "$LOCATION"
rm /home/wger/db/database.sqlite &>/dev/null || true
ln -s "$LOCATION"/database.sqlite /home/wger/db
python3 manage.py migrate || true
echo "Launch app"
su -m -l wger -c "cd /home/wger/src && export FROM_EMAIL='wger Workout Manager <wger@example.com>' && exec /home/wger/entrypoint.sh"
su -l wger -c "cd /home/wger/src && export FROM_EMAIL='wger Workout Manager <wger@example.com>' && exec /home/wger/entrypoint.sh"