The .dockerignore that halved the build context

A 420 MB build context on a repository that is 60 MB, because .git, node_modules and four years of local uploads were all being sent to the daemon.

$ docker build . 2>&1 | head -1
Sending build context to Docker daemon  418.2MB

# .dockerignore
.git
node_modules
vendor
storage/app/public
*.sqlite
.env*
docker-compose.override.yml

$ docker build . 2>&1 | head -1
Sending build context to Docker daemon   21.4MB

The time saved is real and secondary — the important entry is .env*, because a context that includes an environment file will happily end up in an image if any COPY . exists, and that is how credentials get published. Treating .dockerignore as a security control rather than a performance one changes how carefully it gets reviewed.