42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
cd /var/www/app
|
|
|
|
# Set HOME for npm cache (www-data user needs writable cache directory)
|
|
export HOME=/tmp
|
|
|
|
echo "Setting up dependencies..."
|
|
|
|
# Create vendor directories and fix permissions
|
|
echo "Fixing permissions..."
|
|
mkdir -p bootstrap/cache storage/framework storage/logs public/assets/vendor
|
|
chown -R www-data:www-data bootstrap/cache storage/framework storage/logs public/assets/vendor
|
|
chmod -R ug+rwX bootstrap/cache storage/framework storage/logs public/assets/vendor
|
|
|
|
# Install PHP dependencies
|
|
echo "Installing PHP packages..."
|
|
composer install \
|
|
--no-dev \
|
|
--prefer-dist \
|
|
--no-interaction \
|
|
--optimize-autoloader
|
|
|
|
# Install npm dependencies if package.json has dependencies
|
|
if grep -q "\"dependencies\"" package.json; then
|
|
echo "Installing npm packages..."
|
|
npm ci --omit=dev
|
|
node scripts/setup-vendor.js
|
|
fi
|
|
|
|
# Fix permissions
|
|
echo "Fixing permissions..."
|
|
chown -R www-data:www-data \
|
|
bootstrap/cache \
|
|
public/assets/vendor
|
|
|
|
chmod -R ug+rwX bootstrap/cache
|
|
|
|
echo "✓ Setup complete, starting Apache..."
|
|
exec apache2-foreground
|