1
votes

Scenario: Elastic Beanstalk Environment with Multi Docker platform. NGinx container and PHP7.1 Container PHP/Symfony application

Problem: I need to run Doctrine cli command after deploy to update database. I figured out how to do this dynamically but not automatically with following code.

docker exec $(docker ps | grep php-fpm | awk '{print $1}') php ./bin/console doctrine:schema:update --force 

I deploy with CodePipeline/CodeBuild

1

1 Answers

1
votes

At the end of your Dockerfile

CMD ["/start.sh"]

In your start.sh file

#!/bin/sh
set -xe

php bin/console doctrine:schema:update --force