-: In the last section,
we started up our docker compose up command.
That is now gonna start up our single container
and it's gonna set up two different volume mounts
inside of it, one to kind of bookmark
or hold onto the reference to node modules
locally inside the container,
and the other to map up all of our source code files
on our local machine into the container's app directory.
I now see the successful startup message
from Docker Compose,
so I should now be able to flip back over to my browser,
refresh the app and still see the app appear.
I should also be able to open up my browser
or see my code editor in the source app.js file
and change the by their text again.
So I'll say something like "I was changed"
and then if I save this,
I can flip back with the browser
and see that content up here
and of course, I can always refresh again
and make sure that content is still there.
Awesome, we've now set up the volume mounting system.
There's one really interesting thing
that I wanna mention here.
So like we've said a couple times
by setting up that volume mount,
anytime that the Docker container looks into the app folder
it's essentially gonna get a reference back
to all these local files we have on our machine
and so question that you might be asking yourself
is inside of our Docker file,
do we still have to execute this copy step right here?
Because we're essentially saying copy everything
over into that app directory,
but then anytime that the Docker container
tries to look into that app directory,
actually go back to the local machine
that the container is running on.
So in truth, we could probably get away with
deleting the copy line right here.
We would still want to copy over the package.json file
because we do have to run MP install
to get our dependencies.
But as far as all of our source code goes,
that gets copied over the copy instruction
well, we might be able to do away without that.
Now, for me personally,
I would choose to leave this instruction in, and here's why.
At the end of the day, we're making use of Docker Compose
to solve all this kind of volume mounting stuff
and all this issues with getting
all of our source code over.
But at some point in time in the future,
you might decide to no longer make use of Docker Compose,
or alternatively, you might decide to use this docker file
right here as inspiration to set
up your production docker file.
In either case, you would definitely still need
to have this copy instruction right here.
You would definitely need to still have the copy instruction
to copy over all of your source code
and so even though it's not strictly necessary
for what we're doing right now,
I would probably still leave it in there kind of as a
reminder or a reference for myself in the future.
All right, so that's pretty much it.
We have solved everything we need to solve
with running our react application
in a development environment inside of a Docker container.
We still have a lot of work to do,
however so let's take a quick pause
and continue in the next section.