HaxeFoundation / docker-library-haxe

Docker official image for Haxe
https://hub.docker.com/_/haxe/
MIT License
28 stars 8 forks source link

I can't use the docker machine with another user than root #2

Open stephanerenou opened 7 years ago

stephanerenou commented 7 years ago

Hello, I would like to use the machine to build my code using a mounted volume. The concern is that this generates the files as root on my host. A workaround to this is to run the machine using the user option as -u $UID Unfortunately in that case, haxe complains as below docker run -u $UID -it --rm --name my-running-aa my-haxe-app haxe build.hxml Error: Error: This is the first time you are runing haxelib. Please run haxelib setup first

getting the concern with release 3.4 and 3.4.2

andyli commented 7 years ago

As the error suggested, can you run haxelib setup path/to/somewhere before running haxe build?

This is related to how haxelib stores its local repository path setting in the user's home (in ~/.haxelib IIRC), so the config need to be done for each user... We probably should improve it in haxelib, but I have no concrete idea on how to do it yet.

stephanerenou commented 7 years ago

Hello, just in case someone gets interested, I applied the process described at this url: https://denibertovic.com/posts/handling-permissions-with-docker-volumes/ which allows to start with a specific userID. Then I can run my docker build process as: sudo docker run -e LOCAL_USER_ID=$UID --rm -v "$(pwd)":/tmp/hx -w /tmp/hx myHaxeMachine:1 /bin/bash -c "haxelib setup /usr/local/lib/haxe/lib; haxe build.hxml" this works fine for me.