mirror of
https://github.com/danog/php.git
synced 2024-11-26 20:04:58 +01:00
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:
parent
49ceb8ddbb
commit
e3db777ec6
@ -1,16 +1,5 @@
|
||||
FROM alpine:3.3
|
||||
|
||||
# phpize deps
|
||||
RUN apk add --no-cache --virtual .phpize-deps \
|
||||
autoconf \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
libc-dev \
|
||||
make \
|
||||
pkgconf \
|
||||
re2c
|
||||
|
||||
# persistent / runtime deps
|
||||
RUN apk add --no-cache --virtual .persistent-deps \
|
||||
ca-certificates \
|
||||
@ -37,8 +26,11 @@ ENV PHP_VERSION %%PHP_VERSION%%
|
||||
ENV PHP_FILENAME %%PHP_FILENAME%%
|
||||
ENV PHP_SHA256 %%PHP_SHA256%%
|
||||
|
||||
ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c
|
||||
|
||||
RUN set -xe \
|
||||
&& apk add --no-cache --virtual .build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
curl-dev \
|
||||
gnupg \
|
||||
libedit-dev \
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user