docker-entrypoint.sh contains CR characters with Windows host
mdcfe opened this issue · comments
Issue and Steps to Reproduce
When using Windows as a host, if the repo is cloned with Git and core.autocrlf
is true
, Git will convert the line endings of the files to CRLF. This causes issues when the docker-entrypoint.sh
script is copied into the container, as the added CRs are preserved, causing a confusing error message to appear:
': No such file or directorycute 'sh
Expected Behavior
Docker starts NodeMC Core successfully and the container doesn't immediately exit.
Actual Behavior
The arangodb container starts successfully, but the nodemc container shows errors then exits.
Versions
- Node: 8.5.0
- Client OS: Windows
- NodeMC Version: v6 - core is at 7b9a529
Additional Details
This can be temporarily resolved by stripping CRs before the container is built, for example using a tool like dos2unix
. Ideally this could be done at build time to reduce the chance of user error.
This was briefly mentioned in #support on the Discord server.
In my opinion this can be closed as a wontfix
, as it's not really NodeMC's problem. However, I want to be able to provide out of the box support, so I'm going to suggest that we patch docker-compose.yml
to install dos2unix
into the container, and then run it on the repo via the service.backend.command
field. This is much like how we currently install nodemon on runtime.
Any thoughts? Reasons to not include this?
@jaredallard 👍
While not technically a NodeMC issue, this hinders usability for people since there's an extra invisible step (literally invisible, I suppose) involved in getting NodeMC up and running.
I would have suggested invoking the dos2unix
command after copying the code into the container in the Dockerfile
, since it makes more sense to me to fix this once within the built image rather than each time NodeMC is run, though I may be misinterpreting exactly what docker-compose does when building and starting a container.
@md678685 Ah, right, that's true. We can make that part of the buildstep. I'll push a fix ASAP.
UPDATE
Patched, building it to verify it doesn't error.