Where to put the php artisan migrate command

后端 未结 3 404
被撕碎了的回忆
被撕碎了的回忆 2020-12-09 10:07

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

3条回答
  •  我在风中等你
    2020-12-09 10:24

    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

提交回复
热议问题