如何取消限制 PHP Deployer composer 内存?

How to unlimit PHP Deployer composer memory?

我是 运行ning PHP magento 应用程序的部署者,来自 docker-compose。 Apache 位于容器内,内存限制为 php。如果需要,我可以控制 Dockerfile。

目前我的问题是当我 运行 dep deploy 它崩溃了:

$ dep deploy 
✈︎ Deploying master on main
✔ Executing task deploy:prepare
✔ Executing task deploy:lock
✔ Executing task deploy:release
✔ Executing task deploy:update_code
✔ Executing task deploy:shared
➤ Executing task deploy:vendors
✔ Executing task deploy:failed
✔ Executing task deploy:unlock

In Client.php line 103:
                                                                                                                                                                                                                         
  The command "cd /home/public_html/releases/20201214130007 && /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest" failed.  
                                                                                                                                                                                                                         
  Exit Code: 255 (Unknown error)                                                                                                                                                                                         
                                                                                                                                                                                                                         

如果我 运行 容器内的 composer 行加上无限内存,它会工作:

php -d memory_limit=-1 /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest

我试图强制部署者以这种方式使用作曲家,但没有成功:

# in deployer.php:
set('composer', 'php -d memory_limit=-1  /usr/local/bin/composer');

我认为这是因为它在执行 deployer:vendors 时没有使用集合中的 composer 从详细日志中可以看出:

➤ Executing task deploy:vendors
[main] > if hash unzip 2>/dev/null; then echo 'true'; fi
[main] < true
[main] > if hash composer 2>/dev/null; then echo 'true'; fi
[main] < true
[main] > command -v 'composer' || which 'composer' || type -p 'composer'
[main] < /usr/local/bin/composer
[main] > cd /home/public_html/releases/20201214125356 && /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest

有什么解决方法的建议吗?

要更改部署程序使用的 composer 二进制文件,您需要设置 bin/composer,因此请更改此

set('composer', 'php -d memory_limit=-1  /usr/local/bin/composer');

至此

set('bin/composer', 'php -d memory_limit=-1  /usr/local/bin/composer');