Install build time deps from docker-php-ext-install for alpine

We don't need the build dependencies during runtime, so we temporarily
install them when building extension. This reduces image size with 50%.

We also provide a PHPIZE_DEPS environment variable with the needed deps.
This commit is contained in:
Natanael Copa
2016-05-20 16:11:33 +02:00
parent 49ceb8ddbb
commit e3db777ec6
2 changed files with 12 additions and 11 deletions

View File

@ -55,6 +55,11 @@ if [ -z "$exts" ]; then
exit 1
fi
: ${PHPIZE_DEPS:="autoconf file g++ gcc libc-dev make pkgconf re2c"}
if [ -e /lib/apk/db/installed ]; then
apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS
fi
for ext in $exts; do
(
cd "$ext"
@ -69,3 +74,7 @@ for ext in $exts; do
make -j"$j" clean
)
done
if [ -e /lib/apk/db/installed ]; then
apk del .phpize-deps
fi