techknowlogick / xgo

Go CGO cross compiler
MIT License
477 stars 80 forks source link

running docker as current user conflicts with `/deps` and `/deps-build` #235

Open steabert opened 9 months ago

steabert commented 9 months ago

I'm running xgo with the option:

-dockerargs "-u,$(id -u):$(id -g)"

so that the docker image is run as the current user. This prevents xgo from creating any root-owned files in some of the mounted volumes (since it automatically mounts ~/go and ~/.xgo-cache`).

This works great for me, but I noticed that the build script complains about not being able to create /deps and/or /deps-build (as you would need to be root in the container). I don't use that feature, but I wondered if it would be possible to also couple these to user-owned directories somehow? That would allow xgo to maybe by default run as the current user, which is IMHO a much better solution than trying to chown after the fact.