Windows `CR/LF` line endings in .sh files
Closed this issue · 1 comments
The presence of Windows styles for carriage returns prevents the correct building of the geoserver-docker image. This type of line endings is incompatible with Docker and prevents the image building. To make line endings Linux styled (and Docker compatible) a run of the dos2unix
must be done on all .sh
files. Despite performing this operation some line endings, switch to Windows style (this verified on on Windows wsl Ubuntu) if the docker-compse.yaml file is run for the second time.
For example, the failing file (despite the dos2unix
command run) is /usr/local/bin/docker-entrypoint.sh
and this happens when building the postgres container, the error message is
postgres | 2023-07-25 10:52:36.719 UTC [48] LOG: database system is ready to accept connections
postgres | done
postgres | server started
postgres |
postgres | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/01-init-user.sh
postgres |
postgres | /usr/bin/env: ‘bash\r’: No such file or directory
dependency failed to start: container postgres is unhealthy
@ale-cristofori Windows styles for carriage returns can be disabled by adding * -text
in a .gitattributes
file.
I've created a branch where I added the .gitattributes
to prevent the style conversion. I've tested it and it seems to be fine.
![Screenshot 2023-07-26 125312](https://private-user-images.githubusercontent.com/24936890/256222377-50e193e7-81ba-437d-977a-b432f1ceeb67.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUxMTU4ODgsIm5iZiI6MTcyNTExNTU4OCwicGF0aCI6Ii8yNDkzNjg5MC8yNTYyMjIzNzctNTBlMTkzZTctODFiYS00MzdkLTk3N2EtYjQzMmYxY2VlYjY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MzElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODMxVDE0NDYyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThkMzZjZmU3YTc0YmY4ZGMwNWEwMTlhMTRjMTk3MGU2MTYzNDE0ZGFmOGM1YWIxZWZhNmIwOWEwNDRkMGJjYWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.zqQVH3yy_YmfBYND_BuNm-U4zYW0kQvr3Sm8fpGn6oE)
Can you please try to clone the project with git clone -b 123_CLRF https://github.com/geosolutions-it/docker-geoserver.git
and test the build ?
FYI: @randomorder