Skip to content

Add .dockerignore to exclude ui/node_modules from build context#249

Merged
peterj merged 2 commits intomainfrom
copilot/ignore-ui-node-modules
Mar 3, 2026
Merged

Add .dockerignore to exclude ui/node_modules from build context#249
peterj merged 2 commits intomainfrom
copilot/ignore-ui-node-modules

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 3, 2026

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 #169

Change Type

/kind cleanup

Changelog

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.

Original prompt

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:

$ 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)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Ignore UI node modules when building server image Add .dockerignore to exclude ui/node_modules from build context Mar 3, 2026
@timflannagan
Copy link
Copy Markdown
Collaborator

@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.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 3, 2026

@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 ...

Done — the PR description has been updated to follow the template (Description, Change Type /kind fix, Changelog release-note block, and Additional Notes).

@timflannagan timflannagan marked this pull request as ready for review March 3, 2026 16:15
Copilot AI review requested due to automatic review settings March 3, 2026 16:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .dockerignore with ui/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/
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
ui/.next/
ui/.next/
ui/out/

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
# Version control
.git/
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description references both “Fixes #169” and “Fixes #248”. If only one issue should be auto-closed, please remove/adjust the incorrect reference to avoid linking/closing the wrong item.

Copilot uses AI. Check for mistakes.
@peterj peterj added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 1e03cf3 Mar 3, 2026
12 of 15 checks passed
@peterj peterj deleted the copilot/ignore-ui-node-modules branch March 3, 2026 18:16
christian-posta pushed a commit to christian-posta/agentregistry that referenced this pull request Mar 9, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore UI node modules when building server image

4 participants