City-of-Helsinki/tunnistamo

Add line-ending rules to .gitattributes

Opened this issue · 0 comments

Problem

Certain files are expected to be in LF line-endings during the Docker build process, but depending on a users' git config core.autocrlf setting, these files might not be converted correctly for Windows users.

Motivation

Tunnistamo Docker container cannot be run successfully on Windows-based platforms.

Solution

Two files that should be changed are ./docker-entrypoint.sh and ./manage.py.

If ./docker-entrypoint.sh is some other line-ending than LF, the following error will be given when the docker container tries to start:

exec ./docker-entrypoint.sh: no such file or directory

If ./manage.py is some other line-ending than LF, the following error will be given:

Applying database migrations...
/usr/bin/env: ‘python\r’: No such file or directory

The following additions to ./.gitattributes should be made to fix the issues:

manage.py text eol=lf
*.sh text eol=lf

Additionally, the command git add --renormalize . should be run to convert the line endings according to these rules.