fix(docker): add git safe dir to data dir #720
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the requirement that: Newer versions of git needs the 'git config --global --add safe.directory /data' setting to work in a container.
Here is an example to verify both the problem and the fix:
Problem:
docker build -f docker/Dockerfile-debian -t reusetest_default .
2). Run the code in reuse compliant project, I used my script project (https://github.com/janderssonse/janderscripts)
docker run --rm --volume $(pwd):/data reusetest_default lint
Result: Fails respecting .gitignore etc as the git config will fail and show warning '---no VCS'' etc.
Fix:
3). Now try the same dockerfile but with the added fix in this pr:
docker build -f docker/Dockerfile-debian -t reusetest_with_git_add_data_safe .
4). Run on same example repo as before (https://github.com/janderssonse/janderscripts)
docker run --rm --volume $(pwd):/data reusetest_with_git_add_data_safe lint
Result
: success - git (vcs) accepted, .gitignore respected etc.