docker.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. PORT=3429 # Port to run the server on
  3. echo "EXTERNAL_PORT=$PORT" >.env
  4. eval "git clone https://github.com/hikariatama/Hikka"
  5. cd Hikka
  6. touch hikka-install.log
  7. if ! [ -x "$(command -v docker-compose)" ]; then
  8. printf "\033[0;34mInstalling docker...\e[0m"
  9. if [ -f /etc/debian_version ]; then
  10. sudo apt-get install \
  11. apt-transport-https \
  12. ca-certificates \
  13. curl \
  14. gnupg-agent \
  15. software-properties-common -y 1>hikka-install.log 2>&1
  16. curl -fsSL https://download.docker.com/linux/ubuntu/gpg |
  17. sudo apt-key add - 1>hikka-install.log 2>&1
  18. sudo add-apt-repository \
  19. "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  20. $(lsb_release -cs) \
  21. stable" 1>hikka-install.log 2>&1
  22. sudo apt-get update -y 1>hikka-install.log 2>&1
  23. sudo apt-get install docker-ce docker-ce-cli containerd.io -y 1>hikka-install.log 2>&1
  24. elif [ -f /etc/arch-release ]; then
  25. sudo pacman -Syu docker --noconfirm 1>hikka-install.log 2>&1
  26. elif [ -f /etc/redhat-release ]; then
  27. sudo yum install -y yum-utils 1>hikka-install.log 2>&1
  28. sudo yum-config-manager \
  29. --add-repo \
  30. https://download.docker.com/linux/centos/docker-ce.repo
  31. sudo yum install docker-ce docker-ce-cli containerd.io -y 1>hikka-install.log 2>&1
  32. fi
  33. printf "\033[0;32m - success\e[0m\n"
  34. # Hikka uses docker-compose so we need to install that too
  35. printf "\033[0;34mInstalling docker-compose...\e[0m"
  36. pip install -U docker-compose 1>hikka-install.log 2>&1
  37. chmod +x /usr/local/bin/docker-compose
  38. printf "\033[0;32m - success\e[0m\n"
  39. else
  40. printf "\033[0;32mDocker is already installed\e[0m\n"
  41. fi
  42. printf "\033[0;34mBuilding docker image...\e[0m"
  43. sudo docker-compose up -d --build 1>hikka-install.log 2>&1
  44. printf "\033[0;32m - success\e[0m\n"
  45. printf "\033[0;32mFollow this url to continue installation:\e[0m\n"
  46. ssh "-o StrictHostKeyChecking=no" "-R 80:127.0.0.1:$PORT" "nokey@localhost.run" 2>&1 | grep "tunneled"