mirror of
https://github.com/roundcube/roundcubemail-docker.git
synced 2026-02-18 12:51:44 +01:00
45 lines
884 B
Bash
Executable File
45 lines
884 B
Bash
Executable File
#!/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."
|