download 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. EDITION=${1:-community}
  3. # Define ANSI escape codes for colors
  4. YELLOW='\033[0;33m'
  5. BLUE='\033[0;34m'
  6. NC='\033[0m' # No Color
  7. if [ -d "./src" ]; then
  8. echo "Error: The \"src\" directory is not empty. Please remove all contents within this directory and try again."
  9. exit 1
  10. fi
  11. bin/stop
  12. bin/start --no-dev
  13. [ $? != 0 ] && echo "Failed to start Docker services" && exit
  14. bin/setup-composer-auth
  15. bin/fixowns
  16. if [ "$EDITION" == "mageos" ]; then
  17. VERSION=${2:-1.0.5}
  18. bin/clinotty composer create-project --repository-url=https://repo.mage-os.org/ mage-os/project-community-edition="${VERSION}" .
  19. else
  20. VERSION=${2:-2.4.7-p3}
  21. bin/clinotty composer create-project --repository=https://repo.magento.com/ magento/project-"${EDITION}"-edition="${VERSION}" .
  22. fi
  23. if [ $? != 0 ]; then
  24. echo -e "${BLUE}Please check the installation guide at ${YELLOW}https://github.com/markshust/docker-magento#install-fails-because-project-directory-is-not-empty${BLUE} for troubleshooting.${NC}"
  25. else
  26. bin/clinotty [ ! -f "./var/composer_home/auth.json" ] && bin/clinotty mkdir -p ./var/composer_home && bin/clinotty cp /var/www/.composer/auth.json ./var/composer_home/auth.json
  27. fi