element-hq / element-hq/element-web

docker build fails when initialized as a git submodule

Open
#14,031 3 comments 1 reaction 0 assignees View on GitHub
T-Defect
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

## Description

I have a repository where I manage all of my personal services' dockerfiles so that I can build them from source rather than have to worry about Docker, Inc. images in threat models. It's a makefile and a bunch of git submodules.

When riot-web is added a submodule, `.git` looks like this:

```
rrix@kusanagi:~/Code/dockerfiles/riot-web :) file .git
.git: ASCII text
rrix@kusanagi:~/Code/dockerfiles/riot-web :) cat .git
gitdir: ../.git/modules/riot-web
```
the `Dockerfile` copies the source in to the container, including this submodule stub, but obviously not the .git directory itself. I believe I could work around this by converting it to a git subtree, but this feels like a bad compromise, I am using submodules in their intended usecase right now.

Since this is a personal build for one user, I am comfortable simply removing the RUN docker-write-version command, but perhaps there's a solution to this worth considering, or at least documenting for the next person to try to do this.

### Steps to reproduce

```
mkdir /tmp/dockerfiles
git init /tmp/dockerfiles
git -C /tmp/dockerfiles submodule add https://github.com/vector-im/riot-web/
docker build /tmp/dockerfiles/riot-web/ -t riot-web:scratchbuild
```

### Version information

- **Platform**: web

For the web app:

- **Browser**: irrelevant
- **OS**: linux/docker
- **URL**: tag v1.6.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.