Skip to content

Instantly share code, notes, and snippets.

@bestlong
Last active September 11, 2016 04:52
Show Gist options
  • Save bestlong/f32aa8eb68ef09b02d81bac5e08160f2 to your computer and use it in GitHub Desktop.
Save bestlong/f32aa8eb68ef09b02d81bac5e08160f2 to your computer and use it in GitHub Desktop.
Laravel 遇到 shared hosting 環境又只能透過 ftp 傳輸到主機,先做個打包壓縮處理提高上傳效率
#!/usr/bin/env bash
TAR_FILENAME=_production-upload.tar.gz
npm install
gulp --production
# 拿掉 dev 環境相依套件
composer install --prefer-dist --no-dev
php artisan config:cache
php artisan route:cache
# 打包壓縮
tar -czf ./$TAR_FILENAME \
--exclude=.git* --exclude=.idea --exclude=.DS_Store \
--exclude=./tar-laravel-prod-app.sh \
--exclude=.env* \
--exclude=./node_modules \
--exclude=./storage \
--exclude=./$TAR_FILENAME \
./
# 回復到開發模式
composer install
gulp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment