-
Notifications
You must be signed in to change notification settings - Fork 129
/
update.sh
executable file
·42 lines (33 loc) · 1002 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
#!/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'
)
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/%%VERSION%%/'"$VERSION"'/;
s/%%CMD%%/'"${CMD[$variant]}"'/;
' $template | tr '¬' '\n' > "$dir/Dockerfile"
echo "✓ Wrote $dir/Dockerfile"
done
# Use perl to avoid problems with BSD vs. GNU sed, which have incompatible
# argument syntax for editing files in-place.
perl -pi -e "s/1\.[0-9]\.[0-9]+-/${VERSION}-/" .github/workflows/build.yml
echo "Updating version in build.yml workflow"
echo "Done."