Hello there Diego! Well, if you're on your development environment, you could set up a new volume in your docker-compose file that you can link to your project's root directory. That way, any changes you make to code will be reflected automatically in your docker container
Hello there DeUliZeaLand, Highlighting from part of my post: When we were defining the Laravel App container inside our docker-compose file, we defined a volumes entry: ./storage:/var/www/storage whereby the left side before the colon represents our host machine and the right side after the colon represents our docker machine. So in this case, instead of just using the storage folder, you can adjust this entry to become: .:/var/www which will now link you entire project to your docker container. Again, only do this in your development environment, not your production environment.
Hello there, for starters, we have different configurations for our production and development environment. As such, we only want to persist the necessary files for production in our production environment. Because of this, we'd rather not create a volume that persists our entire project folder, but rather we want the volume to persist only our necessary files. That's why we have used commands like COPY so that we only copy necessary files that we have no problem discarding when re-creating our docker container and we've only persisted necessary data like the Storage folder which store user data.
Hello there Diego! Well, if you're on your development environment, you could set up a new volume in your docker-compose file that you can link to your project's root directory. That way, any changes you make to code will be reflected automatically in your docker container
Hi brian , can you give me some example to do that ?
Hello there DeUliZeaLand, Highlighting from part of my post: When we were defining the Laravel App container inside our docker-compose file, we defined a volumes entry:
./storage:/var/www/storage
whereby the left side before the colon represents our host machine and the right side after the colon represents our docker machine. So in this case, instead of just using thestorage
folder, you can adjust this entry to become:.:/var/www
which will now link you entire project to your docker container. Again, only do this in your development environment, not your production environment.Hello Brian,
can you elaborate why it isn't good idea to do it in production environment?
Hello there, for starters, we have different configurations for our production and development environment. As such, we only want to persist the necessary files for production in our production environment. Because of this, we'd rather not create a volume that persists our entire project folder, but rather we want the volume to persist only our necessary files. That's why we have used commands like
COPY
so that we only copy necessary files that we have no problem discarding when re-creating our docker container and we've only persisted necessary data like the Storage folder which store user data.Thanks for your explanation Brian. It's very great tutorial. Hope you make some other tutorial again docker