geosolutions-it/docker-geoserver

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

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