Skip to content

Commit

Permalink
Fix unsafe repo error from Alpine build containers
Browse files Browse the repository at this point in the history
Resolve the `fatal: unsafe repository
('/path/to/repo' is owned by someone else)` error message
thrown by newer Git versions by:

- execute Alpine Docker build containers as non-root user
  - attempt current UID by default, fallback to trying UID 1000
- explicitly set `GOCACHE` environment variable to `/tmp/`
  within build container
  - resolve permission issue with the go toolchain attempting to
    use `/.cache` by default within the Docker container

refs GH-159
  • Loading branch information
atc0005 committed May 5, 2022
1 parent 7031e97 commit 235e7ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,20 @@ docker: clean
docker version
@docker image pull $(DOCKER_BUILD_IMG_X86)
@docker container run \
--user $${UID:-1000} \
--rm \
-i \
-v $$PWD:$$PWD \
-w $$PWD \
$(DOCKER_BUILD_IMG_X86) \
make windows-x86-static linux-x86-static
env GOCACHE=/tmp/ make windows-x86-static linux-x86-static
@docker image pull $(DOCKER_BUILD_IMG_X64)
@docker container run \
--user $${UID:-1000} \
--rm \
-i \
-v $$PWD:$$PWD \
-w $$PWD \
$(DOCKER_BUILD_IMG_X64) \
make windows-x64-static linux-x64-static
env GOCACHE=/tmp/ make windows-x64-static linux-x64-static
@echo "Completed all cross-platform builds via Docker containers ..."

0 comments on commit 235e7ea

Please sign in to comment.