-
-
Save artmouse/c4bd330224a229c7d3c99f8e8d578e65 to your computer and use it in GitHub Desktop.
Magento 2 Deployment Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOCKFILE=deploy.lock | |
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then | |
echo "-- ERROR" | |
echo "-- Deployment is already running" | |
exit | |
fi | |
# Remove lock file when exiting | |
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT | |
echo $$ > ${LOCKFILE} | |
# Make sure we are in the right directory | |
if [ ! -f ./app/etc/config.php ]; then | |
echo "-- ERROR" | |
echo "-- This doesn't look like a Magento 2 install. Please make sure" | |
echo "-- that you are running this from the Magento main doc root dir" | |
exit | |
fi | |
# Begin deployment | |
php bin/magento maintenance:enable | |
# Composer | |
composer install | |
php bin/magento setup:upgrade | |
php bin/magento setup:di:compile | |
# Deploy locales for associated themes | |
php -d memory_limit=-1 bin/magento setup:static-content:deploy -f en_US | |
# php -d memory_limit=-1 bin/magento setup:static-content:deploy -f --exclude-area=adminhtml en_CA | |
# php -d memory_limit=-1 bin/magento setup:static-content:deploy -f --exclude-area=adminhtml fr_CA | |
# php -d memory_limit=-1 bin/magento setup:static-content:deploy -f --exclude-area=adminhtml es_MX | |
# php -d memory_limit=-1 bin/magento setup:static-content:deploy -f --exclude-area=adminhtml pt_BR | |
php bin/magento cache:flush | |
php bin/magento maintenance:disable | |
php bin/magento cache:enable | |
# Remove lock file | |
rm -f ${LOCKFILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment