[GH-ISSUE #1018] Building Dockerfile-build in submodule fails #1807

Closed
opened 2026-03-01 18:36:32 +03:00 by kerem · 1 comment
Owner

Originally created by @clarsen on GitHub (Sep 30, 2021).
Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/1018

Describe the bug

if netboot.xyz is added as submodule and then we attempt to build it, git running within the docker build fails due to .git being a file instead of a directory (or non-existant) due to COPY bringing it into the container.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir test
  2. cd test; git init
  3. git submodule add https://github.com/netbootxyz/netboot.xyz.git external/netboot.xyz
  4. docker build -t localbuild -f external/netboot.xyz/Dockerfile-build external/netboot.xyz

Expected behavior

Successful build

Screenshots

Example failure:

TASK [netbootxyz : Check out latest iPXE sources] ******************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/git ls-remote https://github.com/ipxe/ipxe -h refs/heads/master", "msg": "fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz", "rc": 128, "stderr": "fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz\n", "stderr_lines": ["fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz"], "stdout": "", "stdout_lines": []}

Additional context

To fix, add to .dockerignore:

.git
Originally created by @clarsen on GitHub (Sep 30, 2021). Original GitHub issue: https://github.com/netbootxyz/netboot.xyz/issues/1018 **Describe the bug** <!-- A clear and concise description of what the bug is. --> if netboot.xyz is added as submodule and then we attempt to build it, git running within the docker build fails due to .git being a file instead of a directory (or non-existant) due to COPY bringing it into the container. **To Reproduce** Steps to reproduce the behavior: 1. mkdir test 2. cd test; git init 3. git submodule add https://github.com/netbootxyz/netboot.xyz.git external/netboot.xyz 4. docker build -t localbuild -f external/netboot.xyz/Dockerfile-build external/netboot.xyz **Expected behavior** <!-- A clear and concise description of what the bug is. --> Successful build **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> Example failure: ``` TASK [netbootxyz : Check out latest iPXE sources] ****************************** fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/usr/bin/git ls-remote https://github.com/ipxe/ipxe -h refs/heads/master", "msg": "fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz", "rc": 128, "stderr": "fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz\n", "stderr_lines": ["fatal: not a git repository: /ansible/../../.git/modules/external/netboot.xyz"], "stdout": "", "stdout_lines": []} ``` **Additional context** <!-- Add any other context about the problem here. --> To fix, add to .dockerignore: ``` .git ```
kerem 2026-03-01 18:36:32 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@antonym commented on GitHub (Sep 30, 2021):

Thanks!

<!-- gh-comment-id:931711229 --> @antonym commented on GitHub (Sep 30, 2021): Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/netboot.xyz#1807
No description provided.