composer update;
rm -rf var/di/* var/generation/* var/cache/* var/log/* var/page_cache/*;
php bin/magento cache:clean;
php bin/magento cache:flush;
php bin/magento setup:upgrade;
php -d memory_limit=6G bin/magento setup:static-content:deploy -f;
php -d memory_limit=6G bin/magento setup:di:compile;
php -d memory_limit=6G bin/magento indexer:reindex;
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
cd ..
chown -R www-data:www-data magento/