-
Notifications
You must be signed in to change notification settings - Fork 4
/
argo_run_docker.sh
97 lines (91 loc) · 3.35 KB
/
argo_run_docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env sh
SCRIPT_DIR=$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)
cd "$SCRIPT_DIR" || exit
if ! command -v docker > /dev/null 2>&1; then
echo "Docker is not installed, Do you want to download Docker? (Y/n): "
read -r download_choice
download_choice=${download_choice:-Y}
case "$download_choice" in
[Yy]*)
if ! command -v brew > /dev/null 2>&1; then
echo "Homebrew is not installed, Do you want to download Homebrew? (Y/n): "
read -r download_choice1
download_choice1=${download_choice1:-Y}
case "$download_choice1" in
[Yy]*)
if ! curl -s https://shencha-model-platform.oss-cn-shanghai.aliyuncs.com/brew_install.sh | bash; then
echo "Failed to install Homebrew. Please install Homebrew/Docker manually."
echo "Homebrew: https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/"
echo "Docker: https://www.docker.com/"
exit 1
fi
;;
*)
echo "Homebrew is required, please download Homebrew manually."
exit 1
;;
esac
else
echo "Homebrew updating, please wait a moment..."
brew update
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
if ! brew install docker; then
echo "Failed to install Docker. Please install Docker manually."
echo "Docker: https://www.docker.com/"
exit 1
fi
;;
Darwin*)
if ! brew install --cask --appdir=/Applications docker; then
echo "Failed to install Docker. Please install Docker manually."
echo "Docker: https://www.docker.com/"
exit 1
fi
;;
*)
echo "Unknown OS: ${unameOut}"
exit 1
;;
esac
;;
*)
echo "Docker is required, please download Docker manually."
exit 1
;;
esac
fi
if ! docker info > /dev/null 2>&1; then
echo "Docker not started, will start. Do not close Docker while running"
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
sudo systemctl start docker
;;
Darwin*)
open /Applications/Docker.app
;;
*)
echo "Unknown OS: ${unameOut}"
exit 1
;;
esac
else
echo "Docker application has been started"
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
echo "System detected as Linux, run ollama inside..."
curl -s https://shencha-model-platform.oss-cn-shanghai.aliyuncs.com/argo_run_ollama_inside.sh | cat | sh -s "$@"
;;
Darwin*)
echo "System detected as macOS, run ollama outside..."
curl -s https://shencha-model-platform.oss-cn-shanghai.aliyuncs.com/argo_run_ollama_outside.sh | cat | sh -s "$@"
;;
*)
echo "Unknown OS: ${unameOut}"
;;
esac