share-lt/cmd/docker-entrypoint.sh

37 lines
1.1 KiB
Bash
Raw Normal View History

2026-01-25 16:03:51 +00:00
#!/bin/sh
set -e
2026-01-26 15:20:11 +00:00
# run_as_www() {
# # prefer su-exec (alpine), fallback to runuser if available, otherwise run directly
# if command -v su-exec >/dev/null 2>&1; then
# su-exec www "$@"
# elif command -v runuser >/dev/null 2>&1; then
# runuser -u www -- "$@"
# else
# "$@"
# fi
# }
2026-01-25 16:03:51 +00:00
# Build front-end assets if Vite manifest is missing
if [ ! -f /var/www/public/build/manifest.json ]; then
echo "Building front-end assets (vite)..."
run_as_www npm ci
run_as_www npm run build
fi
# Wait for database directory to be mounted
2026-01-26 15:20:11 +00:00
# if [ ! -f /var/www/database/database.sqlite ]; then
# echo "Creating database..."
# # create the sqlite file as the www user so ownership matches app files
# run_as_www sh -c 'touch /var/www/database/database.sqlite'
# run_as_www php artisan migrate --force
# fi
2026-01-25 16:03:51 +00:00
# Fix storage permissions
2026-01-26 15:20:11 +00:00
# echo "Fixing storage permissions..."
# chown -R www:www /var/www/storage /var/www/bootstrap/cache
# chmod -R 775 /var/www/storage /var/www/bootstrap/cache
2026-01-25 16:03:51 +00:00
# Execute the main command
exec "$@"