We have a directory tree like this:
.
├── README.md
├── .git
│ ├── modules
│ │ └── code-server-images
│ │ └── code-server
│ │ ├── modules
│ │ │ └── lib
│ │ │ └── vscode
│ │ │ └── ...
│ │ └── ...
│ └── ...
├── code-server-images
│ ├── code-server
│ │ ├── .git "gitdir: ../../.git/modules/code-server-images/code-server"
│ │ ├── lib
│ │ │ └── vscode
│ │ │ ├── .git "gitdir: ../../../../.git/modules/code-server-images/code-server/modules/lib/vscode"
│ │ │ └── ...
│ │ └── ...
│ ├── images
│ │ └── base.containerfile
│ └── ...
└── ...
When building the code-server images, we only copy the contents of code-server-images/code-server
into the image. But at some point, the build script of code-server / vscode runs some git commands and git tries to resolve the gitdir
entry and fails:
fatal: not a git repository: /app/lib/vscode/../../../../.git/modules/code-server-images/code-server/modules/lib/vscode
I would like to avoid copying the whole repository into the image, even if I exclude directories that are not needed.
Is it possible to move the .git
directory of the submodules into their working directories?