问题描述
有什么方法可以覆盖AWS Elastic BeanStalk默认的composer安装命令吗?
Is there some way how to override AWS Elastic BeanStalk default composer install command?
我想运行composer install --no-dev
.
推荐答案
是的,您可以在AWS Beanstalk中将额外的标志附加到composer命令.
Yes, you can append extra flags to the composer command in AWS Beanstalk.
您需要在<app-root-dir>/.ebextensions/composer.config
中创建一个额外的配置文件:
You need to create an extra config file in <app-root-dir>/.ebextensions/composer.config
:
commands:
10updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
aws:elasticbeanstalk:application:environment:
option_name: COMPOSER_HOME
value: /root
aws:elasticbeanstalk:container:php:phpini:
composer_options: --no-dev
在composer_options
中输入的任何内容都将附加到作曲家命令行中.
Whatever you put in composer_options
will be appended to the composer command line.
您可以通过查看您的/var/log/eb-activity.log
文件来验证此操作是否正确执行.注意以下内容:
You can verify this is executed correctly by looking at your /var/log/eb-activity.log
file. Look out for something like this:
++ /opt/elasticbeanstalk/bin/get-config optionsettings -n aws:elasticbeanstalk:container:php:phpini -o composer_options
+ PHP_COMPOSER_OPTIONS=--no-dev
+ echo 'Found composer.json file. Attempting to install vendors.'
Found composer.json file. Attempting to install vendors.
+ composer.phar install --no-ansi --no-interaction --no-dev
有关更多信息,您可以阅读手册中的作曲家文件" 部分.
For more info you can read the Composer File section in the manual.
这篇关于无需开发要求即可在AWS上安装Composer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!