V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
esons
V2EX  ›  Docker

PHP 安装 gd 库 加载 freetype 的时候报错 有没有大神了解的

  •  
  •   esons · 2023-11-28 19:10:21 +08:00 · 811 次点击
    这是一个创建于 386 天前的主题,其中的信息可能已经有所发展或是发生改变。

    FROM php:7.2-fpm-alpine

    COPY custom.php.ini /usr/local/etc/php/conf.d/docker-php-custom.ini

    RUN apk add autoconf g++ make util-linux-dev re2c icu-dev freetype-dev
    openssl-dev pcre-dev libtool imagemagick imagemagick-dev postgresql-dev tzdata linux-headers git sudo libbsd libxml2-dev libzip-dev
    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

    RUN docker-php-ext-configure gd --enable-gd --with-freetype RUN pecl install redis RUN docker-php-ext-enable redis

    RUN docker-php-ext-install gd
    && docker-php-ext-install intl
    && docker-php-ext-install mysqli
    && docker-php-ext-install zip
    && docker-php-ext-install pdo_mysql
    && docker-php-ext-install pcntl
    && docker-php-ext-install pdo_pgsql
    && docker-php-ext-install soap
    && docker-php-ext-install bcmath
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    && chmod +x /usr/local/bin/composer

    报错信息: => ERROR [php72 4/8] RUN docker-php-ext-configure gd --enable-gd --with 14.3s

    [php72 4/8] RUN docker-php-ext-configure gd --enable-gd --with-freetype: 1.148 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/APKINDEX.tar.gz 4.128 fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/aarch64/APKINDEX.tar.gz 7.641 (1/5) Installing dpkg-dev (1.20.0-r0) 9.347 (2/5) Installing dpkg (1.20.0-r0) 11.00 (3/5) Installing libmagic (5.38-r0) 12.50 (4/5) Installing file (5.38-r0) 13.90 (5/5) Installing .phpize-deps-configure (20231128.092650) 13.90 Executing busybox-1.31.1-r19.trigger 13.92 OK: 591 MiB in 158 packages 13.97 Configuring for: 13.97 PHP Api Version: 20170718 13.97 Zend Module Api No: 20170718 13.97 Zend Extension Api No: 320170718 14.27 configure: error: unrecognized options: --enable-gd, --with-freetype


    failed to solve: process "/bin/sh -c docker-php-ext-configure gd --enable-gd --with-freetype" did not complete successfully: exit code: 1

    1 条回复    2023-11-28 19:40:04 +08:00
    default996
        1
    default996  
       2023-11-28 19:40:04 +08:00
    我自己是用这个的

    ```
    FROM php:8.2-fpm-alpine

    # 到 https://github.com/mlocati/docker-php-extension-installer
    # 手动下载 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions
    # 然后放到 scripts 目录下
    COPY scripts/* /usr/local/bin/


    RUN install-php-extensions apcu bcmath calendar gd gettext ...其它扩展
    ```

    搞定
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5581 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 01:29 · PVG 09:29 · LAX 17:29 · JFK 20:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.