Use var for the php version

This commit is contained in:
Tilo Spannagel 2018-03-08 09:52:55 +01:00
parent 5c05c9eba0
commit a82a812df0
No known key found for this signature in database
GPG Key ID: B89F1626A58E1429
3 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
FROM php:7.1-%%VARIANT%% FROM php:%%PHP_VERSION%%-%%VARIANT%%
# entrypoint.sh and cron.sh dependencies # entrypoint.sh and cron.sh dependencies
RUN set -ex; \ RUN set -ex; \

View File

@ -1,4 +1,4 @@
FROM php:7.1-%%VARIANT%% FROM php:%%PHP_VERSION%%-%%VARIANT%%
# entrypoint.sh and cron.sh dependencies # entrypoint.sh and cron.sh dependencies
RUN set -ex; \ RUN set -ex; \

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
set -eo pipefail set -eo pipefail
declare -A php_version=(
[default]='7.1'
)
declare -A cmd=( declare -A cmd=(
[apache]='apache2-foreground' [apache]='apache2-foreground'
[fpm]='php-fpm' [fpm]='php-fpm'
@ -59,6 +63,7 @@ for latest in "${latests[@]}"; do
# Replace the variables. # Replace the variables.
sed -ri -e ' sed -ri -e '
s/%%PHP_VERSION%%/'"${php_version[$version]-${php_version[default]}}"'/g;
s/%%VARIANT%%/'"$variant"'/g; s/%%VARIANT%%/'"$variant"'/g;
s/%%VERSION%%/'"$latest"'/g; s/%%VERSION%%/'"$latest"'/g;
s/%%CMD%%/'"${cmd[$variant]}"'/g; s/%%CMD%%/'"${cmd[$variant]}"'/g;