-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·41 lines (33 loc) · 889 Bytes
/
deploy.sh
File metadata and controls
executable file
·41 lines (33 loc) · 889 Bytes
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
#!/bin/bash
set -e
command_exists() {
command -v "$1" >/dev/null 2>&1
}
image_exists() {
local image_name=$1
if docker image inspect "$image_name" >/dev/null 2>&1; then
return 0
else
return 1
fi
}
get_compose_cmd() {
if command_exists "docker" && docker compose version >/dev/null 2>&1; then
echo "docker compose"
elif command_exists "docker-compose"; then
echo "docker-compose"
else
echo "none"
fi
}
compose_cmd=$(get_compose_cmd)
if [ "$compose_cmd" = "none" ]; then
echo "Error: Neither 'docker compose' nor 'docker-compose' is available."
echo "Please install Docker with Compose plugin or standalone docker-compose."
exit 1
fi
if ! image_exists "mysql:8" || ! image_exists "redis:7.4"; then
$compose_cmd pull mysql redis
fi
$compose_cmd pull share
$compose_cmd up -d --remove-orphans