Astro-Otter
Astro-Otter

Reputation: 873

Dockerfile PHP error build with "error php_intl.lo"

I'm building a PHP 7.4 container based on dunglas/symfony-docker but i've got this error during build :

/bin/sh /usr/src/php/ext/intl/libtool --mode=compile cc  -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -DU_DEFINE_FALSE_AND_TRUE=1 -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/usr/src/php/ext/intl -DPHP_ATOM_INC -I/usr/src/php/ext/intl/include -I/usr/src/php/ext/intl/main -I/usr/src/php/ext/intl -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -c /usr/src/php/ext/intl/php_intl.c -o php_intl.lo 
make: /bin/sh: Operation not permitted
make: *** [Makefile:192: php_intl.lo] Error 127
ERROR: Service 'php' failed to build: The command '/bin/sh -c set -eux;     apk add --no-cache --virtual .build-deps        $PHPIZE_DEPS        icu-dev         libzip-dev      zlib-dev    ;       docker-php-ext-configure zip;   docker-php-ext-install -j$(nproc)       intl        zip     ;   pecl install        apcu-${APCU_VERSION}    ;   pecl clear-cache;   docker-php-ext-enable       apcu        opcache     ;   runDeps="$(         scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions           | tr ',' '\n'           | sort -u           | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }'     )";     apk add --no-cache --virtual .phpexts-rundeps $runDeps; 

It looks like permission error but i don't know how to fix it (and i'm not admin of my laptop). Here's my dockerfile :

ARG PHP_VERSION=7.4

# "php" stage
FROM php:${PHP_VERSION}-fpm-alpine AS symfony_php

RUN apk add --no-cache \
        acl \
        fcgi \
        file \
        gettext \
        git \
        jq \
    ;

ARG APCU_VERSION=5.1.19
RUN set -eux; \
    apk add --no-cache --virtual .build-deps \
        $PHPIZE_DEPS \
        icu-dev \
        libzip-dev \
        zlib-dev \
    ; \
    \
    docker-php-ext-configure zip; \
    docker-php-ext-install -j$(nproc) \
        intl \
        zip \
    ; \
    pecl install \
        apcu-${APCU_VERSION} \
    ; \
    pecl clear-cache; \
    docker-php-ext-enable \
        apcu \
        opcache \
    ; \
    \
    runDeps="$( \
        scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
            | tr ',' '\n' \
            | sort -u \
            | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
    )"; \
    apk add --no-cache --virtual .phpexts-rundeps $runDeps; \
    \
    apk del .build-deps

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY docker/php7-fpm/conf.d/symfony.dev.ini $PHP_INI_DIR/conf.d/symfony.ini

RUN set -eux; \
    { \
        echo '[www]'; \
        echo 'ping.path = /ping'; \
    } | tee /usr/local/etc/php-fpm.d/docker-healthcheck.conf

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"

COPY docker/php7-fpm/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck

HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
COPY docker/php7-fpm/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

And docker-compose.yml :

version: "3.4"

services:
    # PHP
    php:
        build:
            context: docker/php7-fpm
            target: symfony_php
        restart: unless-stopped
        healthcheck:
            interval: 10s
            timeout: 3s
            retries: 3
            start_period: 30s
        container_name: dso_php
        hostname: php
        volumes:
            - ./:/var/www/deep-space-objects:rw,cached
            - ./docker/php7-fpm/conf.d/symfony.dev.ini:/usr/local/etc/php/conf.d/symfony.ini

OS and docker versions :

Thanks

Upvotes: 1

Views: 865

Answers (1)

Astro-Otter
Astro-Otter

Reputation: 873

Fixed with :

ARG PHP_VERSION=7.4
# "php" stage
FROM php:${PHP_VERSION}-fpm-alpine3.13 AS symfony_php

From this issue : https://github.com/docker-library/php/issues/1130

Upvotes: 1

Related Questions