-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose-amd.sh
More file actions
executable file
·92 lines (79 loc) · 1.83 KB
/
Copy pathcompose-amd.sh
File metadata and controls
executable file
·92 lines (79 loc) · 1.83 KB
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
#!/bin/sh
# Load environment variables from .env file
set -a
. .env
set +a
services=""
if [ "$ENABLE_LLAMA" = "true" ]; then
services="$services llama"
fi
if [ "$ENABLE_SD" = "true" ]; then
services="$services sd"
fi
#remove the first space
services="${services# }"
# Function to build the images
build_images() {
echo "Building the images for services: $services"
docker-compose -f docker-compose.amd.yml build nginx $services
}
# Function to start the containers
start_containers() {
#need to define profiles like --profile llama --profile sd to use services for that, make some fancy string manipulation
local profiles=""
for service in $services; do
profiles="$profiles --profile $service"
done
echo "Starting the containers for services: $profiles"
docker-compose -f docker-compose.amd.yml $profiles up -d --remove-orphans
}
# Function to stop the containers
stop_containers() {
echo "Stopping the containers..."
docker-compose -f docker-compose.amd.yml stop
}
# Function to restart the containers
restart_containers() {
echo "Restarting the containers..."
docker-compose -f docker-compose.amd.yml restart
}
# Function to remove the containers
remove_containers() {
echo "Removing the containers..."
docker-compose -f docker-compose.amd.yml down
}
# Function to display container status
container_status() {
echo "Container status:"
docker-compose -f docker-compose.amd.yml ps
}
# Parse command line arguments
case "$1" in
start)
start_containers
;;
stop)
stop_containers
;;
restart)
stop_containers
start_containers
;;
remove)
stop_containers
remove_containers
;;
status)
container_status
;;
rebuild)
build_images
;;
build)
build_images
;;
*)
echo "Usage: $0 {start|stop|restart|remove|status|rebuild|build}"
exit 1
;;
esac