I've just spent two hours talking to the duck figuring out how to install extensions in docker on Alpine. I hope this post will avoid the same for you. This is how I got the intl extension (ext-intl
) installed in a docker container based on Alpine Linux:
RUN set -xe \
&& apk add --update \
icu \
&& apk add --no-cache --virtual .php-deps \
make \
&& apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
zlib-dev \
icu-dev \
g++ \
&& docker-php-ext-configure intl \
&& docker-php-ext-install \
intl \
&& docker-php-ext-enable intl \
&& { find /usr/local/lib -type f -print0 | xargs -0r strip --strip-all -p 2>/dev/null || true; } \
&& apk del .build-deps \
&& rm -rf /tmp/* /usr/local/lib/php/doc/* /var/cache/apk/*
Btw, this is used for the PHPScraper faasd/openfaas function of my PHP web-scraping lib - might be of interest to you to :)
🙏🙏🙏
Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.
Published