34 lines
939 B
Bash
34 lines
939 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
APP_SOURCE=${APP_SOURCE:-/opt/app}
|
|
APP_TARGET=${APP_TARGET:-/var/www/html}
|
|
APP_USER=${APP_USER:-www-data}
|
|
APP_GROUP=${APP_GROUP:-www-data}
|
|
|
|
mkdir -p "${APP_TARGET}"
|
|
|
|
# Sync the built application from the immutable image into the shared app volume
|
|
# while preserving runtime data that lives under storage/.
|
|
rsync -a --delete \
|
|
--exclude storage \
|
|
--exclude public/storage \
|
|
--exclude bootstrap/cache \
|
|
--exclude .env \
|
|
"${APP_SOURCE}/" "${APP_TARGET}/"
|
|
|
|
cd "${APP_TARGET}"
|
|
|
|
mkdir -p storage/framework/{cache,sessions,testing,views} storage/logs bootstrap/cache
|
|
chown -R "${APP_USER}:${APP_GROUP}" storage bootstrap/cache || true
|
|
find storage -type d -exec chmod 775 {} \;
|
|
find storage -type f -exec chmod 664 {} \;
|
|
chmod -R ug+rwx bootstrap/cache
|
|
|
|
php artisan config:cache --quiet || true
|
|
php artisan route:cache --quiet || true
|
|
php artisan event:cache --quiet || true
|
|
|
|
exec "$@"
|