Thank me later: How to install PHP ext-intl in docker on Alpine Linux

Subscribe to my newsletter and never miss my upcoming articles

I've just spent two hours talking to the duck. I hope this post will avoid the same for you. This is how I got the intl extension installed in docker 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 parsing lib - might be of interest to you to :)

No Comments Yet