GTBitsOfGood / GTBitsOfGood/juno
Juno docker build fails on windows machines
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
The Docker build can fail on Windows checkouts because the helper shell scripts under `docker/` are checked out with CRLF line endings.
For example, `docker/get_grpc_probe.sh` is copied successfully into the Alpine image, but executing it fails with a misleading error like:
```text
/bin/sh: get_grpc_probe.sh: not found
```
The script itself exists and its contents are valid. The issue is that the shebang is checked out as:
```text
#!/bin/sh\r\n
```
so Linux effectively attempts to use `/bin/sh\r` as the interpreter.
## Reproduction
On a Windows checkout with:
```text
core.autocrlf=true
```
both of the following scripts contain CRLF line endings:
```text
docker/get_grpc_probe.sh
docker/get_protoc.sh
```
This can be confirmed by inspecting the file bytes or checking for carriage returns.
## Proposed fix
Add a `.gitattributes` file to the Juno repository that explicitly requires Unix line endings for shell scripts and Dockerfiles, for example:
```gitattributes
* text=auto
*.sh text eol=lf
Dockerfile text eol=lf
*.dockerfile text eol=lf
```
Then renormalize the existing tracked files:
```bash
git add --renormalize .
```
and commit the resulting changes.
This would ensure that shell scripts are checked out with LF line endings even on Windows systems where `core.autocrlf=true`.
Optionally, CI could also include a check that rejects CRLF line endings in executable shell scripts to prevent regressions.
## Why this is preferable
Normalizing the files manually fixes an individual checkout, but the issue can recur for any developer cloning the repository on Windows. Enforcing the line endings through `.gitattributes` makes the requirement part of the repository itself and avoids relying on developers' local Git configuration.
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect docker/get_grpc_probe.sh and docker/get_protoc.sh, then reproduce the checkout with core.autocrlf=true and verify their line endings. Add the repository line-ending rules described in the issue, renormalize tracked files, and confirm the Docker build no longer fails when the scripts are executed from a Windows checkout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, git, shell
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100