如何使用Composer和Docker处理缺少的依赖项?

问题描述

我有一个要安装在Docker笔记本电脑上进行本地开发的应用程序。该应用程序需要composer中的库。

为了避免运行作曲家,我想避免在笔记本电脑和所有必要的扩展程序上安装PHP。

我也不想在我的应用程序容器内部进行构建时运行composer,因为我需要使用装载绑定将本地计算机上的vendor文件夹。

对于here所述,通过docker容器安装composer似乎是我的理想解决方案:

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  composer install 

但是,这样做时,如何解决任何PHP依赖项冲突?

例如

docker run --rm --interactive --tty \
       --volume $PWD:/app \
       composer require phpoffice/phpspreadsheet

将失败

Using version ^1.14 for phpoffice/phpspreadsheet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.14.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - phpoffice/phpspreadsheet 1.14.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - Installation request for phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.0,1.14.1].

我该如何解决这类问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)