I'm starting to use Docker on projects, and the majority of these projects runs on PHP (some on Nginx/PHP-FPM, some on Apache/PHP as module).
The thing is: my brain can't understand when to use the ADD and VOLUME directives on the Dockerfile for the paths that holds the source code.
Here's what I want: to change a line of code, access the browser on the container port, and see the changes. And so on, until things run as expected and then I "add" the code to the machine and deploy it. It's how I think Docker runs. Am I wrong?
AFAIK, the ADD directive copies the files on the given path to the image, and the VOLUME directive just say that a given path will me mounted by|on the Host.
Things that run through my mind, so far:
Add the source code files via ADD, and then user the "-v" switch on command line to mount the source code on the same path used on ADD.
Use VOLUME, and deal with two different Dockerfiles: for development containers, and for testing/development, and build each one as needed (this thing I think is counterproductive, and my heart tells me that this is not how it should work).
Can someone help me with this? What my brain can't grasp, and I should do (and understand) to leverage my Docker knowledge?