Prerequisites
Description
The docker/entrypoint.sh script gets run in an Alpine Linux container, where it is expected to have Linux line endings (just a line-feed). It will produce an error about incorrect syntax when /bin/sh tries to run it if the line endings are Windows line-endings.
Unfortunately, Git can be (and commonly is) configured to "correct" line endings in checked out files to those used by the local system (in my case, Windows). When I checked out this repo, the entrypoint.sh script had its line endings changed to Windows' CRLF (carriage-return and line-feed), giving me syntax errors when Alpine tries to run the script (which gets copied into the container as defined by the dev Dockerfile).
Steps to Reproduce
The quickest response will be spurred by providing a Postman json file with the exact request or progression of requests that cause the issue.
If a Postman file cannot be provided:
-
Be on Windows
-
Have a Git install configured to change line endings to CRLF
-
Clone the `cve-services` repository
- Follow the
docker/README.md instructions for instantiating a local dev instance of cve-services
- Observe a
/bin/sh syntax error (my apologies, I didn't capture the exact error message before fixing it myself locally).
Expected behavior:
Be able to run entrypoint.sh in Alpine without syntax errors.
Actual behavior:
/bin/sh in Alpine reports syntax errors for entrypoint.sh, causing container startup to fail.
Reproduces how often:
100% of the time on Windows when the repository was checked out with a Git config that replaces line endings with Windows line endings.
Versions
I've only tried to current instance of the repo.
Additional Information
You can use Git attributes to fix this, by specifying with them that the entrypoint.sh file should never have its line endings changed during Git checkout. See the Git docs for more info: https://git-scm.com/docs/gitattributes#_eol
Prerequisites
Description
The
docker/entrypoint.shscript gets run in an Alpine Linux container, where it is expected to have Linux line endings (just a line-feed). It will produce an error about incorrect syntax when/bin/shtries to run it if the line endings are Windows line-endings.Unfortunately, Git can be (and commonly is) configured to "correct" line endings in checked out files to those used by the local system (in my case, Windows). When I checked out this repo, the
entrypoint.shscript had its line endings changed to Windows' CRLF (carriage-return and line-feed), giving me syntax errors when Alpine tries to run the script (which gets copied into the container as defined by the dev Dockerfile).Steps to Reproduce
The quickest response will be spurred by providing a Postman json file with the exact request or progression of requests that cause the issue.
If a Postman file cannot be provided:
docker/README.mdinstructions for instantiating a local dev instance ofcve-services/bin/shsyntax error (my apologies, I didn't capture the exact error message before fixing it myself locally).Expected behavior:
Be able to run
entrypoint.shin Alpine without syntax errors.Actual behavior:
/bin/shin Alpine reports syntax errors forentrypoint.sh, causing container startup to fail.Reproduces how often:
100% of the time on Windows when the repository was checked out with a Git config that replaces line endings with Windows line endings.
Versions
I've only tried to current instance of the repo.
Additional Information
You can use Git attributes to fix this, by specifying with them that the
entrypoint.shfile should never have its line endings changed during Git checkout. See the Git docs for more info: https://git-scm.com/docs/gitattributes#_eol