We have a Docker project that is shared by developers using Windows, Mac or Linux.
Unfortunately we can't control the way the project is cloned, so Windows developers might end up with bad line-endings when building the Docker image and the build could fail because of that.
To fix this issue, we added a line to our Dockerfile to replace all Windows line endings with Unix line endings before the build process is started:
ADD . /app
RUN find . -type f -exec sed -i 's/\x0d//g' {} \+
But the problem is, the build is now much slower, even on Linux and Mac boxes.
I would like to RUN
this command only if the build is happening on a Windows machine. But is there a way for the Dockerfile to detect that?