Skip to content

Instantly share code, notes, and snippets.

@donamkhanh
Last active August 9, 2016 02:21
Show Gist options
  • Save donamkhanh/30a8da24a2a3695cc5dcb70cd56e9d2f to your computer and use it in GitHub Desktop.
Save donamkhanh/30a8da24a2a3695cc5dcb70cd56e9d2f to your computer and use it in GitHub Desktop.
Scripts for deploying Magento2
#!/bin/sh
echo "Switch to working folder"
cd /var/www/
echo "Pulling latest code"
sudo git reset --hard origin/master && sudo git pull
echo "Running Magento 2 deployment script..."
echo "Removing ./var/generation, ./var/view_preprocessed and ./pub/static folders..."
sudo rm -rf ./var/generation/* && sudo rm -rf ./var/view_preprocessed/* && sudo rm -rf ./pub/static/*
echo "Upgrading module..."
sudo docker exec -it moto_app_1 ./bin/magento-php setup:upgrade
echo "Deploying static content..."
sudo docker exec -it moto_app_1 ./bin/magento-php setup:static-content:deploy
echo "Clearing cache..."
sudo docker exec -it moto_app_1 ./bin/magento-php cache:flush
echo "Applying folder permissions..."
sudo chmod -R 777 ./var && sudo chmod -R 777 ./pub
echo "Purging Varnish..."
curl -X PURGE http://magento.dev/
echo "The deployment script has completed execution."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment