Trying to deploy the laravel application on docker stack .What I am confused or not able to figure out is where can I run this php artisan migrate:fresh t
This is how I solved it .Created a bash script called run.sh and added the php artisan migrations commands followed by the php serve command.
run.sh
#!/bin/sh
cd /app
php artisan migrate:fresh --seed
php artisan serve --host=0.0.0.0 --port=$APP_PORT
Added entrypoint to the Dockerfile removing the CMD in the end which will run the commands desired.
copy ./run.sh /tmp
ENTRYPOINT ["/tmp/run.sh"]
Remove the command from the docker-compose.yml