Skip to content

[Bug]: getting "exec /app: no such file or directory" when generating a python image with a distroless base image #533

Open
@jorgedomingomasmovil

Description

@jorgedomingomasmovil

What happened?

Hello,

I have another issue related to this problem open in rules_oci.

Basically I am using the example provided by rules_oci to generate a python image with a distroless as base image. The problem is that the file generated with the py_binary rule from aspect_rules_py generates a script to run with bash, it executes an exec on the last line

exec "{{EXEC_PYTHON_BIN}}" {{INTERPRETER_FLAGS}} "$(rlocation {{ENTRYPOINT}})" "$@"

and distroless do not have bash to be able to run that script to execute the python binary so I get the error of:

exec /oci_python_image/hello_world/hello_world: no such file or directory

The solution proposed in the other issue I have open works but it involves using the py_binary rule of another dependency, I would like to know if there is any way to use the py_binary from aspect_rules_py with distroless or is it going to be implemented?

Thanks in advance

Version

Development (host) and target OS/architectures: host is Mac and target is debian 12.9 (python distroless from google)

Output of bazel --version:
bazel 7.4.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
bazel_dep(name = "aspect_rules_py", version = "1.3.1")

Language(s) and/or frameworks involved: python and py_binary from aspect_rules_p

How to reproduce

Using the example provided by rules_oci (https://github.com/aspect-build/bazel-examples/blob/main/oci_python_image/hello_world/BUILD.bazel) but using a distroless as base image

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneed: investigationInvestigation required to proceed further

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions