forked from roundcube/roundcubemail-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·44 lines (35 loc) · 884 Bytes
/
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
#!/bin/bash
# set -eu
declare -A CMD=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
)
declare -A BASE=(
[apache]='debian'
[fpm]='debian'
[fpm-alpine]='alpine'
)
declare -A EXTRAS=(
[apache]='¬RUN a2enmod rewrite'
[fpm]=''
[fpm-alpine]=''
)
VERSION="${1:-$(curl -fsS https://roundcube.net/VERSION.txt)}"
#set -x
echo "Generating files for version $VERSION..."
for variant in apache fpm fpm-alpine; do
dir="$variant"
mkdir -p "$dir"
template="templates/Dockerfile-${BASE[$variant]}.templ"
cp templates/docker-entrypoint.sh "$dir/docker-entrypoint.sh"
cp templates/php.ini "$dir/php.ini"
sed -E -e '
s/%%VARIANT%%/'"$variant"'/;
s/%%EXTRAS%%/'"${EXTRAS[$variant]}"'/;
s/%%VERSION%%/'"$VERSION"'/;
s/%%CMD%%/'"${CMD[$variant]}"'/;
' $template | tr '¬' '\n' > "$dir/Dockerfile"
echo "✓ Wrote $dir/Dockerfile"
done
echo "Done."