dex icon indicating copy to clipboard operation
dex copied to clipboard

Expand .dockerignore to reduce unnecessary cache invalidation

Open singhvishalkr opened this issue 6 months ago • 2 comments

Fixes #1968

The Dockerfile uses COPY . . which copies the entire source tree into the build context. This means any change to files that aren't needed for the build (like .git/, docs/, examples/) still invalidates the Docker layer cache.

This is particularly noticeable with .git/ -- every new commit, branch, or tag causes a full rebuild even though the actual source code hasn't changed.

The fix expands .dockerignore to exclude:

  • .git/ and .gitignore
  • docs/, examples/, and Markdown files
  • Editor and CI configs (.github/, .editorconfig, etc.)
  • Development-only files (docker-compose*.yaml, config.dev.yaml)
  • The Dockerfile itself

This keeps the build context minimal and focused on what the image actually needs: Go source files, dependencies (go.mod/go.sum), config.docker.yaml, and web/ templates.

singhvishalkr avatar May 16 '26 06:05 singhvishalkr

@singhvishalkr thanks for the PR!

Could you please run git rebase HEAD~1 --signoff to pass the DCO?

nabokihms avatar May 20 '26 14:05 nabokihms

Signed off the commit and force-pushed 0dc9ccfe. The DCO check should rerun on the updated branch.

singhvishalkr avatar Jun 17 '26 05:06 singhvishalkr