js_image_layer omits the repo mapping file, so @bazel/runfiles resolution fails inside the resulting container when bzlmod is enabled.
Version
Development (host) and target OS/architectures:
Output of bazel --version: 7.3.1
Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 1.37.0
Language(s) and/or frameworks involved:
How to reproduce
Via `js_image_layer`, build a container image containing a `js_binary` target with a runfiles dependency, and with bzlmod enabled. The binary can do nothing but:
const runfiles = require('@bazel/runfiles')
runfiles.resolve('<repo name>/<runfile>')
Run the container. It will fail with "Error: could not resolve module /".
If you inspect the container contents (e.g. with dive), you can see that the app layer has no .repo_mapping file.
What happened?
js_image_layer
omits the repo mapping file, so @bazel/runfiles resolution fails inside the resulting container when bzlmod is enabled.Version
Development (host) and target OS/architectures:
Output of
bazel --version
: 7.3.1Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: 1.37.0Language(s) and/or frameworks involved:
How to reproduce
Run the container. It will fail with "Error: could not resolve module/".
If you inspect the container contents (e.g. with
dive
), you can see that the app layer has no.repo_mapping
file.