Amazon-Elastic-Beanstalk [SOLVED]: Composer install on AWS without development requirements

Amazon-Elastic-Beanstalk [SOLVED]: Composer install on AWS without development requirements

Home Forums Amazon Web Services Amazon Elastic Beanstalk Amazon-Elastic-Beanstalk [SOLVED]: Composer install on AWS without development requirements

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #201353

    Cloudy Point
    Keymaster

    QuestionQuestion

    Is there some way how to override AWS Elastic BeanStalk default composer install command?

    I want to run composer install --no-dev.

    #201354

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Yes, you can append extra flags to the composer command in AWS Beanstalk.

    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
    

    Whatever you put in composer_options will be appended to the composer command line.

    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.

    Source: https://stackoverflow.com/questions/46156706/composer-install-on-aws-without-development-requirements
    Author: Julian
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.