无法在 docker 上安装 laravel/收银员,因为 dompdf



Project 使用 docker php:7.1-fpm 映像来运行我的 laravel 应用程序。
当通过prooph/composer:7.2安装laravel/收银员时,它会抛出一个错误:

Problem 1
- laravel/cashier v7.1.0 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- laravel/cashier v7.1.1 requires dompdf/dompdf ^0.8.0 -> satisfiable by dompdf/dompdf[v0.8.0, v0.8.1, v0.8.2].
- dompdf/dompdf v0.8.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- dompdf/dompdf v0.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
- Installation request for laravel/cashier ^7.1 -> satisfiable by laravel/cashier[v7.1.0, v7.1.1].
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/php.ini
- /usr/local/etc/php/conf.d/amqp.ini
- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
- /usr/local/etc/php/conf.d/docker-php-ext-intl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-soap.ini
- /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
- /usr/local/etc/php/conf.d/mongodb.ini
- /usr/local/etc/php/conf.d/php7.ini
- /usr/local/etc/php/conf.d/redis.ini
- /usr/local/etc/php/conf.d/zmq.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.


这是我的码头文件内容:

FROM php:7.1-fpm
RUN echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list &&
curl -L http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb -o /deb-multimedia-keyring.deb &&
dpkg -i /deb-multimedia-keyring.deb
RUN apt-get update && apt-get install -y 
libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev cron libcurl3 imagemagick libav-tools python
RUN docker-php-ext-configure mcrypt && 
docker-php-ext-install -j$(nproc) iconv mcrypt pdo_mysql opcache && 
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && 
docker-php-ext-install -j$(nproc) gd
RUN echo "* * * * * root php /var/www/tidytide/artisan schedule:run &> /var/log/cron.artisan" >> /etc/crontab
WORKDIR /var/www/tidytide
COPY --chown=www-data:www-data . .
COPY ./entrypoint.sh /
ENTRYPOINT /entrypoint.sh


问题是收银员需要dompdf包,这需要在php上启用gd库。GD 库是通过 dockerfile 安装的,正如我所看到的,dompdf 没有观察到这一点。

如果使用不同的容器(和不同的 PHP 版本(进行作曲家安装,则可能应该在composer.json中使用platform设置来模拟实际运行应用的容器配置:

"config": {
"platform": {
"php": "7.1",
"ext-gd": "*"
}
},

Composer 的行为就像您正在使用启用了 GD 扩展的 PHP 7.1,即使您实际使用 PHP 7.2 而没有此扩展来运行 Composer。

相关内容

  • 没有找到相关文章

最新更新