This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
Custom Python toolchain for building rules_docker targets #2029
Labels
Can Close?
Will close in 30 days unless there is a comment indicating why not
🐞 bug report
Affected Rule
All rules using a binary created by the
py_binary
rule, likedownload_pkgs
andcontainer_layer
.Is this a regression?
Didn't verify this.
Description
I've installed https://github.com/asdf-vm/asdf on my local machine to handle multiple languages for multiple projects. When I try to build anything with rules_docker I get an error from
asdf
:This means that the HOME variable changed and
asdf
can't find the Python installation. This particular case is fixed by passing in additionalaction_env
when running bazel:I don't want the build to rely on an externally installed version of Python, but I want the build system to be responsible for compiling Python itself. There are tons of articles on this topic, so far so good.
The problem I'm running into is to get rules_docker to use a Bazel toolchain registered Python interpreter for building docker images. I've tried https://github.com/digital-plumbers-union/rules_pyenv and manually setting up a Python toolchain like:
It doesn't seem to matter where or how I register the Python toolchain. The registered toolchain works as expected for locally built py_binary targets, but does not work for rules_docker. I know this because when I remove the
--action_env
flags from the build command when building a rules_docker target, I get the same errorunknown command: python3. Perhaps you have to reshim?
.🔬 Minimal Reproduction
asdf plugin-add bazel https://github.com/mrinalwadhwa/asdf-bazel.git
asdf plugin-add python
asdf install
bazel build //:test_pkgs
unknown command: python3. Perhaps you have to reshim?
in the output🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_docker version:
Anything else relevant?
This issue seems to touch on similar topics #1680
The text was updated successfully, but these errors were encountered: