Skip to content

Instantly share code, notes, and snippets.

@rmclain
Created August 9, 2013 16:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmclain/6195165 to your computer and use it in GitHub Desktop.
Save rmclain/6195165 to your computer and use it in GitHub Desktop.
Place this file within .ebextensions/ which should be located in the root folder on the same level as your /app and /vendor folders.
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
files:
"/var/app/composer.json":
mode: "000744"
content:
{
"require": {
"aws/aws-sdk-php": "*"
}
}
container_commands:
"1-install-composer":
command: "cd /var/app; curl -s http://getcomposer.org/installer | php"
"2-install-dependencies":
command: "cd /var/app; php composer.phar install"
"3-cleanup-composer":
command: "rm -Rf /var/app/composer.*"
@j03k64
Copy link

j03k64 commented Apr 6, 2014

For a prod server you might want to add --optimize-autoloader as an argument to the composer install in the 2-install-dependencies coomand.

Reference: https://getcomposer.org/doc/03-cli.md
--optimize-autoloader (-o): Convert PSR-0/4 autoloading to classmap to get a faster autoloader. This is recommended especially for production, but can take a bit of time to run so it is currently not done by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment