-
Notifications
You must be signed in to change notification settings - Fork 5
/
update.sh
executable file
·60 lines (53 loc) · 1.19 KB
/
update.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
#!/usr/bin/env bash
set -e
phpVersions='8.3 8.2 8.1 8 8.0 7 7.4 7.3'
distros='debian alpine'
for variant in $phpVersions; do
for distro in $distros; do
for type in 'default' 'xdebug'; do
extraSed=''
template="Dockerfile.template"
dir="$variant"
varientD=""
if [ "$distro" != "debian" ]; then
dir="$dir-$distro"
varientD="-$distro"
extraSed='
'"$extraSed"'
/##<debian>##/,/##<\/debian>##/d;
'
else
extraSed='
'"$extraSed"'
/##<alpine>##/,/##<\/alpine>##/d;
'
fi
if [ "$type" != "default" ]; then
dir="$variant-$type"
fi
if [[ "$variant" == 5* ]]; then #php5
extraSed='
'"$extraSed"'
/##<opencensus>##/,/##<\/opencensus>##/d;
'
else #php7
extraSed='
'"$extraSed"'
/##<mcrypt>##/,/##<\/mcrypt>##/d;
'
fi
if [ "$type" != "xdebug" ]; then
extraSed='
'"$extraSed"'
/##<xdebug-enable>##/,/##<\/xdebug-enable>##/d;
'
fi
rm -rf "$dir"
mkdir -p "$dir"
sed -E '
'"$extraSed"'
s/%%VARIANT%%/'"$variant-cli$varientD"'/;
' $template >"$dir/Dockerfile"
done
done
done