-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst-last.sh
46 lines (40 loc) · 1.11 KB
/
first-last.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
#!/bin/sh
getComposeFileFromServiceName() {
echo "${PWD}/$1/docker-compose.yml"
}
doDockerComposeUp() {
SERVICE_DOCKER_FILE_NAME=$(getComposeFileFromServiceName "$1")
docker compose -f "$SERVICE_DOCKER_FILE_NAME" --project-name "$1" --env-file ${PWD}/"$1"/.env up --build -d
}
doDockerCompose() {
SERVICE_DOCKER_FILE_NAME=$(getComposeFileFromServiceName "$2")
docker compose -f "$SERVICE_DOCKER_FILE_NAME" --project-name "$2" --env-file ${PWD}/"$2"/.env "$1"
}
start() {
docker volume create alfresco-migrator-db-volume
docker volume create alfresco-migrator-acs-volume
docker volume create alfresco-migrator-acs-log-volume
docker volume create alfresco-migrator-acs-backup-volume
}
purge() {
docker volume rm -f alfresco-migrator-db-volume
docker volume rm -f alfresco-migrator-acs-volume
docker volume rm -f alfresco-migrator-acs-log-volume
docker volume rm -f alfresco-migrator-acs-backup-volume
}
case "$1" in
up)
start
doDockerComposeUp "active"
;;
down)
doDockerCompose "down" "active"
;;
purge)
doDockerCompose "down" "active"
purge
;;
*)
echo "Usage: $0 {up|down|purge}"
;;
esac