docker info > /dev/null 2>&1 # Ensure that Docker is running... if [ $? -ne 0 ]; then echo "Docker is not running." exit 1 fi CYAN='\033[0;36m' LIGHT_CYAN='\033[1;36m' WHITE='\033[1;37m' NC='\033[0m' docker run --rm \ -v $(pwd):/opt \ -w /opt \ source.ananas-web.ru:4437/internal/php:8.2.14 \ sh -c "composer create-project laravel/laravel:^11.0 sitemap.xml && cd sitemap.xml && composer remove --dev laravel/sail && composer config repositories.source.ananas-web.ru/3 '{\"type\": \"composer\", \"url\": \"https://source.ananas-web.ru/api/v4/group/3/-/packages/composer/packages.json\"}'" if [[ -z "${GITLAB_TOKEN}" ]]; then echo -e "${WHITE}Gitlab Token in not found in your env variables, please enter it.${NC}" echo -e "${WHITE}You can get your token here (read_api, read_repository, read_registry): https://source.ananas-web.ru/-/profile/personal_access_tokens${NC}" read GITLAB_TOKEN < /dev/tty echo -e "${WHITE}Enter this line to prevent this request in future:${NC} ${CYAN} echo 'export GITLAB_TOKEN=$GITLAB_TOKEN' >> ~/.bashrc" fi docker run --rm \ -v $(pwd):/opt \ -w /opt \ source.ananas-web.ru:4437/internal/php:8.2.14 \ sh -c "cd sitemap.xml && composer config gitlab-token.source.ananas-web.ru $GITLAB_TOKEN && composer config gitlab-domains source.ananas-web.ru" echo -e "${LIGHT_CYAN}Gitlab repository installed${NC}" echo -e "${WHITE}Making initial commit${NC}" cd sitemap.xml git init --initial-branch=main git add . git commit -m "Initial commit" cd .. echo -e "${LIGHT_CYAN}Installing packages${NC}\n\n" echo -e "${CYAN}Ananas Commander ${NC}" docker run --rm \ -it \ -v $(pwd):/opt \ -w /opt \ source.ananas-web.ru:4437/internal/php:8.2.14 \ sh -c "cd sitemap.xml && composer req ananas/commander --dev && php artisan ananas:commander:install" cd sitemap.xml echo "" if sudo -n true 2>/dev/null; then sudo chown -R $USER: . echo -e "${WHITE}Get started with:${NC} cd sitemap.xml && ./vendor/bin/ananas-commander up" else echo -e "${WHITE}Please provide your password so we can make some final adjustments to your application's permissions.${NC}" echo "" sudo chown -R $USER: . echo -e "${WHITE}Making commit after initialization${NC}" git add . git commit -m "Initialization completed"