teknolis / entrypoint.sh
Codex
fix: minimize entrypoint to avoid blocking HF app startup
9b5a35b
Raw
History Blame Contribute Delete
1.06 kB
#!/bin/sh
set -e
DATA_STORAGE_DIR="/data/storage"
APP_STORAGE_PUBLIC="/var/www/html/storage/app/public"
BUILD_DB="/var/www/html/database/database.sqlite"
RUNTIME_DB="/tmp/database.sqlite"
# Keep startup minimal. HF may report APP_STARTING for a long time if the
# entrypoint touches slow FUSE paths or runs blocking artisan commands.
mkdir -p "${DATA_STORAGE_DIR}" \
"${DATA_STORAGE_DIR}/images" \
"${DATA_STORAGE_DIR}/videos" \
"${DATA_STORAGE_DIR}/audio" \
/tmp 2>/dev/null || true
if [ ! -f "${RUNTIME_DB}" ]; then
cp "${BUILD_DB}" "${RUNTIME_DB}" 2>/dev/null || touch "${RUNTIME_DB}"
fi
chmod 666 "${RUNTIME_DB}" 2>/dev/null || true
rm -rf "${APP_STORAGE_PUBLIC}"
ln -sfn "${DATA_STORAGE_DIR}" "${APP_STORAGE_PUBLIC}"
if [ -f /var/www/html/.env ]; then
sed -i "s|^DB_DATABASE=.*|DB_DATABASE=${RUNTIME_DB}|" /var/www/html/.env
sed -i "s|^APP_URL=.*|APP_URL=https://medilis-teknolis.hf.space|" /var/www/html/.env
fi
echo "[boot] Minimal startup complete. Launching Apache..."
exec apache2-foreground