FULL AI ANALYSIS

GitHub Actions Docker build times out pushing large build context because .cache and node_modules are included

Generated Oct 30, 2026, 9:42:13 AM

Analysis summary

The runner sends the full workspace as the build context. Causes include missing or uncommitted .dockerignore, build command run from repo root including large directories, reliance on actions/checkout default behavior (which checks out everything), and large files tracked in git or LFS pointers expanding context. Fixes: commit a restrictive .dockerignore, use build context directory, or use GitHub Actions' path filters or actions/cache properly to avoid sending heavy directories. Avoid storing large generated files in the repo.

Possible causes

No committed .dockerignore (or it excludes wrong paths) so large folders are sent in build context

95%

Workflow runs docker build from repo root instead of a subdirectory containing Dockerfile and minimal context

60%

Large generated artifacts tracked in Git (not gitignored) or Git LFS pointers expanded by checkout settings

40%

Misconfigured actions/cache causing restore misses and causing node_modules rebuilds inside repo before build

30%

Suggested fixes

1

Diagnostic step 1

Create and commit a .dockerignore that excludes node_modules, .cache, test-artifacts, logs, and other large folders; verify docker build context size locally with docker build --no-cache - < /dev/null or tar -czf - . | wc -c in workspace.

2

Diagnostic step 2

Run docker build from the directory that contains only necessary files (use -f path/to/Dockerfile path/to/context) to restrict context.

3

Diagnostic step 3

Use actions/checkout with fetch-depth: 1 unless history is required, and avoid checking large artifacts into Git; if you must keep them, store in release assets or external storage.

4

Diagnostic step 4

Use actions/cache correctly for node_modules to avoid regenerating heavy folders; verify cache hits in action logs.

5

Diagnostic step 5

Test the workflow on a fork/staging branch after committing .dockerignore; if the repo has large files already committed, use git filter-repo or BFG to remove them and push a cleaned branch (coordinate with team).