35 lines
874 B
Bash
35 lines
874 B
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
|
|
chown -R www-data:www-data bootstrap/cache storage/framework storage/logs
|
|
chmod -R ug+rwX bootstrap/cache storage/framework storage/logs
|
|
|
|
# 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
|
|
fi
|
|
|
|
chmod -R ug+rwX bootstrap/cache
|
|
|
|
echo "✓ Setup complete, starting Apache..."
|
|
exec apache2-foreground
|