This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
Fix 'got a git repository' error when building Docker container #2049
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.
Problem
When building a Buffalo app in a docker container a strange error was thrown but the build would complete successfully:
I learned from (#2028) that
buffalo
creates a git repository if it is run in a directory without. That is the source of theERRO
message above (which might be more appropriate to title a warning).I'm not attempting to modify that behavior, as the commentor in (#2028) asked.
Changes
I am avoiding Buffalo needing to complain about not being in a git repository and attempting to create one itself by running
git init
in the copied source directory. This is a light-weight operation and the directory itself is temporary - just being needed momentarily to build the binary.The alternative approach would be to copy the user's
.git
directory into the Docker container. This is not idea because it could be a very large directory, thereby increasing the container. It is also unnecessary for the purposes of building a Buffalo binary.Testing
Testing on a local application with the changes - it did not display the error message: