Add .dockerignore to exclude ui/node_modules from build context#249
Add .dockerignore to exclude ui/node_modules from build context#249
Conversation
Co-authored-by: timflannagan <[email protected]>
|
@copilot We need to follow the PR description template. Read that file and then edit the description. Otherwise, CI will fail since we have automation that validates the contents of the PR description template. |
Done — the PR description has been updated to follow the template (Description, Change Type |
There was a problem hiding this comment.
Pull request overview
Adds a root .dockerignore to reduce Docker build context size and prevent build context transfer failures caused by problematic files under ui/node_modules (per issue #169).
Changes:
- Introduces
.dockerignorewithui/node_modules/and other common build/artifact directories excluded. - Excludes UI/Go build outputs and common editor/OS metadata from the Docker build context.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Node modules | ||
| ui/node_modules/ | ||
| ui/.next/ |
There was a problem hiding this comment.
Consider also ignoring ui/out/ (Next.js export output). make build-ui writes its artifacts there, so if the UI was built locally this directory can significantly inflate the Docker build context unnecessarily.
| ui/.next/ | |
| ui/.next/ | |
| ui/out/ |
| # Version control | ||
| .git/ |
There was a problem hiding this comment.
…tregistry-dev#249) # Description Docker build fails when `ui/node_modules` is present locally due to a bad file descriptor error during build context transfer. No `.dockerignore` existed to prevent unnecessary files from being sent to the Docker daemon. Adds a `.dockerignore` file that excludes `ui/node_modules` (the primary cause of the error) along with other irrelevant files such as `.git/`, IDE configs, OS metadata, Go/UI build artifacts, docs, and test directories. Fixes agentregistry-dev#169 # Change Type /kind cleanup # Changelog ```release-note NONE ``` # Additional Notes The `ui/node_modules` directory can contain symlinks or special files (like the `classPrivateFieldSet.js` reported in the issue) that cause `lstat` errors during Docker build context transfer on some systems. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Ignore UI node modules when building server image</issue_title> > <issue_description>When I try to build the server docker image locally, I'm running into the following error: > > ```bash > $ docker buildx build --push --platform linux/arm64 -f docker/server.Dockerfile -t localhost:5001/agentregistry-dev/agentregistry/server:v0.2.0-2-g8184a2d --build-arg LDFLAGS="-s -w -X 'github.com/agentregistry-dev/agentregistry/internal/version.Version=v0.2.0-2-g8184a2d' -X 'github.com/agentregistry-dev/agentregistry/internal/version.GitCommit=8184a2d' -X 'github.com/agentregistry-dev/agentregistry/internal/version.BuildDate=2026-03-03' -X 'github.com/agentregistry-dev/agentregistry/internal/version.DockerRegistry=localhost:5001'" . > [+] Building 1.3s (12/33) docker:default > => [internal] load build definition from server.Dockerfile 0.1s > => => transferring dockerfile: 2.78kB 0.0s > => [internal] load metadata for docker.io/library/ubuntu:22.04 0.7s > => [internal] load metadata for docker.io/library/node:22-alpine 0.6s > => [internal] load metadata for docker.io/library/golang:1.25-alpine 0.7s > => [auth] library/node:pull token for registry-1.docker.io 0.0s > => [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s > => [auth] library/golang:pull token for registry-1.docker.io 0.0s > => [internal] load .dockerignore 0.1s > => => transferring context: 2B 0.0s > => [ui-builder 1/8] FROM docker.io/library/node:22-alpine@sha256:e4bf2a82ad0a4037d28035ae71529873c069b13eb0455466ae0bc13363826e34 0.0s > => [builder 1/10] FROM docker.io/library/golang:1.25-alpine@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced 0.0s > => ERROR [internal] load build context 0.2s > => => transferring context: 7.89MB 0.1s > => [runtime 1/6] FROM docker.io/library/ubuntu:22.04@sha256:3ba65aa20f86a0fad9df2b2c259c613df006b2e6d0bfcc8a146afb8c525a9751 0.0s > ------ > > [internal] load build context: > ------ > ERROR: failed to solve: error from sender: lstat ui/node_modules/@babel/helpers/lib/helpers/classPrivateFieldSet.js: bad message > make[1]: *** [Makefile:241: docker-server] Error 1 > make[1]: Leaving directory '/work/agentregistry' > make: *** [Makefile:117: run] Error 2 > ``` > > I'll look into adding a .dockerignore file to this repository that ignores the node_modules.</issue_description> > > <agent_instructions>Bootstrap a .dockerignore file that ignores the node_modules directory along with any other files/directories relevant to this repository. Avoid bloating this file with unnecessary cruft.</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes agentregistry-dev#248 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: timflannagan <[email protected]>
Description
Docker build fails when
ui/node_modulesis present locally due to a bad file descriptor error during build context transfer. No.dockerignoreexisted to prevent unnecessary files from being sent to the Docker daemon.Adds a
.dockerignorefile that excludesui/node_modules(the primary cause of the error) along with other irrelevant files such as.git/, IDE configs, OS metadata, Go/UI build artifacts, docs, and test directories.Fixes #169
Change Type
/kind cleanup
Changelog
Additional Notes
The
ui/node_modulesdirectory can contain symlinks or special files (like theclassPrivateFieldSet.jsreported in the issue) that causelstaterrors during Docker build context transfer on some systems.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.