Search code examples
djangoamazon-web-servicesdockeramazon-ecs

Run command conditionally while deploying with amazon ECS


I am having a django app deployed on ECS. I need to run fixtures, a management command needed to be run inside the container on my first deployment.

I want to have access to run fixtures conditionally, not fixed for first deployment only. One way I was thinking is to maintain a variable in my env, and to run fixtures in entrypoint.sh accordingly.

Is this a good way to go about it? Also, what are some other standard ways to do the same.

Let me know if I have missed some details you might need to understand my problem.


Solution

  • You probably need to handle it in your entrypoint.sh script only.As far as my experience goes, you won't be able to conditionally run commands without a script in case of ECS.