Closed sirbeancounter closed 1 month ago
I managed to solve this problem by mapping /etc/passwd from host to container when running the docker container build image, e.g. by adding the following argument to the docker run command:
--volume /etc/passwd:/etc/passwd:ro
A project using bazel with rust_rules using bzlmod to build a tool coded in Rust seems to work very well. This project is used as a bazel module in another larger project (not Rust) to provide this tool and that also seems to work very well. The problem is in the larger projects CI pipeline where the bazel build is run within a docker container image. It produces the following error after running
bazel build ...
:$USER is
user
and $HOME is set but not to/home/user
, instead it is: HOME=/repo/user/project/buildAny help to understand or debug the problem would be really appreciated. I think it is related to how Cargo locates its home directory. So the build works when users run the build themselves and ~/.cargo (default Cargo home directory) is populated accordingly. The question is how to set up Cargo to work when you need to specify alternative Cargo home directory.