Now talking about copy in the dockerfile,
there is one extra,
bit of configuration we can add to our project.
At the moment this copy instruction copies everything
in the folder where this Docker file lives,
because I just have a dot here,
which means everything.
Previously, I also copied just package dot Jason
to the working directory,
but in this step we copy actually everything.
Now this is something we can do,
everything works, but we can also restrict
what gets copied here.
And we do this by adding a dot Docker ignore file here
the dot at the beginning is important.
If you know git this concept might be familiar to you
with Git, which is a source control tool,
has nothing to do with Docker.
With Git we can add gitignore,
to tell Git to which possibly existing folders and files
in our project folder should not be committed to git.
With Docker ignore,
we can specify which folders and files,
should not be copied by a copy instruction.
And here in Docker ignore
we could also add node modules to ensure,
that if a node modules folder would exist here,
which it doesn't,
but which would be the case,
if they would run npm install on my host machine,
in this project folder,
that such a folder is not getting copied into the image.
Because if we would copy it in,
if it would exist,
we would overwrite the node modules folder
which is created inside of the image
with npm install.
And that's bad,
because our locally existing node modules folder
could be outdated,
could be missing important dependencies
which we did add inside of the image,
Or even if it is up to date,
it simply makes that copy process take a bit longer.
So that's why adding such a Docker ignore file,
could make sense to ensure that certain folders or files
in this case the node modules folder,
are not getting copied
into your image
whenever you use the copy instruction.
So that's why I'm adding it here,
even though we don't strictly need it here.
But again, in case I had a node modules folder,
this ensures it's not getting copied into the image,
but instead we stick to the one
which is created inside of the image with npm install.