-
Notifications
You must be signed in to change notification settings - Fork 2
/
compose-generator.sh
executable file
·61 lines (44 loc) · 1.66 KB
/
compose-generator.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
#!/bin/bash
function renderTemplate() {
TEMPLATE_NAME="${1}"
envsubst < compose-templates/${TEMPLATE_NAME}.ymlt
}
function getMariaDbVersions() {
jq -c -r '.mariadb | .[]' compose-services.json
}
function getMySQLVersions() {
jq -c -r '.mysql | .[]' compose-services.json
}
function getPerconaVersions() {
jq -c -r '.perconadb | .[]' compose-services.json
}
function getPHPFPMVersions() {
jq -c -r '.phpfpm | .[]' compose-services.json
}
function renderVersionBlock() {
TEMPLATE_NAME="${1}"
INPUT="${2}"
CONTAINER_IMAGE_PREFIX="${3}"
XDEBUG__REMOTE_PORT="${4}"
for VERSION in ${INPUT}; do
export VERSION_STRING=$(jq -r '.versionName' <<< ${VERSION})
export VERSION_INT=$(jq -r '.versionCode' <<< ${VERSION})
export CONTAINER_IMAGE=$(jq -r '.containerImage | select (.!=null)' <<< ${VERSION})
export PHP_INI_XDEBUG__REMOTE_PORT=$(jq -r '.xdebugPort | select (.!=null)' <<< ${VERSION})
echo -e '\n'
renderTemplate "${TEMPLATE_NAME}"
done
}
export COMPOSE_SERVICES=""
export VERSION_INT="104"
COMPOSE_SERVICES+=$(renderTemplate "MariaDBRocks")
COMPOSE_SERVICES+=$(renderVersionBlock "MariaDB" "$(getMariaDbVersions)")
COMPOSE_SERVICES+=$(renderTemplate "Nginx")
COMPOSE_SERVICES+=$(renderVersionBlock "PHPFPM" "$(getPHPFPMVersions)")
COMPOSE_SERVICES+=$(renderTemplate "HaProxy")
COMPOSE_SERVICES+=$(renderTemplate "FPM-slim")
#COMPOSE_SERVICES+=$(renderTemplate "MySQL-replication")
COMPOSE_SERVICES+=$(renderVersionBlock "MySQL" "$(getMySQLVersions)")
COMPOSE_SERVICES+=$(renderVersionBlock "PerconaDB" "$(getPerconaVersions)")
COMPOSE_SERVICES+=$(renderTemplate "DisabledContainers")
renderTemplate "ComposeStructure" > docker-compose.yml