The build context is everything not excluded, so a missing .dockerignore uploads the git history, the node modules and the local database to the daemon before anything is built.
# .dockerignore
.git
.github
node_modules
vendor
storage/logs
*.sql
.env
docker-compose.override.yml
# and the check
$ docker build . 2>&1 | head -1
Sending build context to Docker daemon 412.8MB
# after:
Sending build context to Docker daemon 4.1MB
It differs from .gitignore in both directions: vendor is usually ignored by git and must also be ignored here even though the build installs it, and .git is not in .gitignore at all and is often the largest single item. Excluding .env matters most — a build context containing it means a stray COPY . . puts production credentials in a layer.