简体   繁体   中英

How to install composer dependencies on Elastic Beanstalk Multicontainer Docker Environment

I have a PHP application that runs on Docker (php:5.6-apache image). I use AWS Elastic Beanstalk Multicontainer Docker Environment to deploy the app to the cloud (using Dockerrun.aws.json v2).

My problem is that I can't find a good workflow to update the composer dependencies after deploying.

Below the contents of my Dockerrun.aws.json:

{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
      "name": "php-app",
      "host": {
        "sourcePath": "/var/app/current/php-app"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "php-app",
      "image": "php:5.6-apache",
      "essential": true,
      "memory": 512,
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 80
        }
      ],
      "mountPoints": [
        {
          "sourceVolume": "php-app",
          "containerPath": "/var/www/html",
          "readOnly": true
        }
      ]
    }
  ]
}

What is the recommended way to run composer install on Elastic Beanstalk Multicontainer Docker Environment?

It is highly recommended to deploy your application with the dependencies pre-installed. Having your deployment process depend on github and packagist is fragile at best and not recommended. Ideally, you would never run Composer anywhere other than on your development and CI environment. Your CI environment should produce a fully deployable release package (including all dependencies etc.) for staging/production environments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM