setup 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. MEM_BYTES=$(docker info -f '{{.MemTotal}}')
  4. MEM_MB=$(( MEM_BYTES / 1000000 ))
  5. # When Docker Desktop is set to 6GB in the GUI, it is reported as 6227 MB
  6. (( MEM_MB < 6227 )) && echo "There must be at least 6GB of RAM allocated to Docker in order to continue." && exit
  7. DOMAIN=${1:-magento.test}
  8. bin/stop
  9. bin/start --no-dev
  10. [ $? != 0 ] && echo "Failed to start Docker services" && exit
  11. bin/clinotty chmod u+x bin/magento
  12. rm -rf src && mkdir src
  13. echo "Adding Magento modules to Composer allow-plugins directive..."
  14. bin/clinotty composer config --no-plugins allow-plugins.magento/magento-composer-installer true
  15. bin/clinotty composer config --no-plugins allow-plugins.magento/inventory-composer-installer true
  16. bin/clinotty composer config --no-plugins allow-plugins.laminas/laminas-dependency-plugin true
  17. echo "Running, Magento setup:install..."
  18. bin/setup-install "${DOMAIN}"
  19. echo "Copying files from container to host after install..."
  20. bin/copyfromcontainer --all
  21. echo "Forcing deploy of static content to speed up initial requests..."
  22. bin/clinotty bin/magento setup:static-content:deploy -f
  23. echo "Re-indexing with Elasticsearch..."
  24. bin/clinotty bin/magento indexer:reindex
  25. echo "Setting basic URL and generating SSL certificate..."
  26. bin/setup-domain "${DOMAIN}"
  27. echo "Fixing owner and permissions..."
  28. bin/fixowns
  29. bin/fixperms
  30. echo "Clearing the cache to apply updates..."
  31. bin/clinotty bin/magento cache:flush
  32. echo "Installing cron, run 'bin/cron start' to enable..."
  33. bin/clinotty bin/magento cron:install
  34. echo "Turning on developer mode..."
  35. bin/clinotty bin/magento deploy:mode:set developer
  36. cp -r .vscode src/
  37. echo "Docker development environment setup complete."
  38. echo "You may now access your Magento instance at https://${DOMAIN}/"