Lesson 23 / 28

.dockerignore

Speed up builds and avoid leaking secrets by excluding files from the build context with .dockerignore.

Excluding files

Like .gitignore, a .dockerignore file keeps folders like node_modules and .git out of the build context — faster builds, smaller images, no leaked secrets.

node_modules
.git
.env
dist
*.log
Dockerfile
.dockerignore