Skip to content

.tip

· one of the small things

A .dockerignore is the first file in a new Dockerfile's folder

Without one, COPY . . sends node_modules, .git and every local artefact to the build. That's slow, and now and then it ships a secret.

node_modules
.git
.next
*.log
.env*

The syntax is the same as .gitignore. Every build prints the context size at the start, and if it's more than a few megabytes, this file is missing something.

docker