-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGO
executable file
·46 lines (35 loc) · 833 Bytes
/
GO
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
#!/bin/bash
#
# Run the SAGE3 environment
#
SERVER_VERSION=$(docker version -f "{{.Server.Version}}")
SERVER_VERSION_MAJOR=$(echo "$SERVER_VERSION"| cut -d'.' -f 1)
echo "Docker Version:" $SERVER_VERSION
if [ "${SERVER_VERSION_MAJOR}" -ge 20 ] && [ "$OSTYPE" = "darwin" ] ; then
# Now compose part of docker
CMD="docker compose"
else
# Need docker-compose script
CMD="docker-compose"
fi
# trap ctrl-c and call cleanup()
trap cleanup SIGINT
modules="-f docker-compose.yml"
function cleanup() {
echo "-- Trapped CTRL-C --"
$CMD $modules stop
$CMD $modules rm -f
exit
}
if [ $# -eq 0 ]; then
echo "Docker Run"
$CMD $modules up --remove-orphans
else
if [ $1 = "stop" ]; then
echo "Docker Stop"
# Stop running the containers
$CMD $modules stop
# Remove stopped containers
$CMD $modules rm -f
fi
fi