mirror of
https://github.com/docker-library/php.git
synced 2025-08-05 00:09:03 +00: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:
@ -1,16 +1,5 @@
|
|||||||
FROM alpine:3.3
|
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
|
# persistent / runtime deps
|
||||||
RUN apk add --no-cache --virtual .persistent-deps \
|
RUN apk add --no-cache --virtual .persistent-deps \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
@ -37,8 +26,11 @@ ENV PHP_VERSION %%PHP_VERSION%%
|
|||||||
ENV PHP_FILENAME %%PHP_FILENAME%%
|
ENV PHP_FILENAME %%PHP_FILENAME%%
|
||||||
ENV PHP_SHA256 %%PHP_SHA256%%
|
ENV PHP_SHA256 %%PHP_SHA256%%
|
||||||
|
|
||||||
|
ENV PHPIZE_DEPS autoconf file g++ gcc libc-dev make pkgconf re2c
|
||||||
|
|
||||||
RUN set -xe \
|
RUN set -xe \
|
||||||
&& apk add --no-cache --virtual .build-deps \
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
$PHPIZE_DEPS \
|
||||||
curl-dev \
|
curl-dev \
|
||||||
gnupg \
|
gnupg \
|
||||||
libedit-dev \
|
libedit-dev \
|
||||||
|
@ -55,6 +55,11 @@ if [ -z "$exts" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
for ext in $exts; do
|
||||||
(
|
(
|
||||||
cd "$ext"
|
cd "$ext"
|
||||||
@ -69,3 +74,7 @@ for ext in $exts; do
|
|||||||
make -j"$j" clean
|
make -j"$j" clean
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -e /lib/apk/db/installed ]; then
|
||||||
|
apk del .phpize-deps
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user