0

I'm working on changing my environment from vagrant to docker and I came across one hitch. With vagrant I have a bash file that will pull data from ftp and restore it in my local so that I can work with the most up to date data.

This is my code

php artisan db:restore --database=mysql --source=ftp --sourcePath=$(date +'%Y')"/"$(date +'%m')"/"$(date +%m-%d-%Y -d "yesterday")".gz" --compression=gzip

php artisan migrate

Inside of my work container I run this and it wont find the mysql command because mysql is in a different container. What can I do to fix my work flow?

bstory
  • 852
  • 9
  • 28

1 Answers1

0

This answer is about rails migrations, but you could take a similar approach to laravel. Create a container that has the required laravel tools and required MySQL tools (likely this) to connect to the database.

You could then combine it with a suggestion in this answer and create a migration script that you can add to your image. As larsks points out in the comments, it would allow you to encapsulate the logic for where to get the backup data and how to restore it in one place. Assuming you named this script restore, you could run your restore command like this

docker run myimage restore
Community
  • 1
  • 1
Roman
  • 19,581
  • 6
  • 68
  • 84