I had this exact same issue and solved it by using a entrypoint.sh executable file as follows: #!/bin/sh set -e # Exit immediately if a command exits with a non-zero status
echo "Running migrations..." python manage.py migrate
echo "Collecting static files..." python manage.py collectstatic --noinput
echo "Starting the application..." exec gunicorn sgrat_dms.wsgi:application --bind 0.0.0.0:8000
The trick here was that the Start Command in the Additional Configuration section of the AWS App Runner service had to be blank so that it would default to the entrypoint.sh file. The problem is that if you have already set this, it can't be unset. I had to create a new service and keep the Start Command blank and deploy from the original image. This actually worked and now runs migrations when a new container is deployed.