<@U02KAN6061E> Random question.. I'm trying to rep...
# general
p
@bitter-ability-32190 Random question.. I'm trying to replicate your blog post. I need to use dockerfiles directly and copy the pex files as the build happens remotely
Copy code
FROM balenalib/raspberrypi4-64-python:3.9-bullseye as deps
COPY ./dist/teletom.tom.entry/manager_deps.pex /binary-deps.pex

RUN PEX_TOOLS=1 python3 /binary-deps.pex venv --scope=deps --compile /bin/app

FROM balenalib/raspberrypi4-64-python:3.9-bullseye as srcs
COPY ./dist/teletom.tom.entry/manager_srcs.pex /binary-srcs.pex

RUN PEX_TOOLS=1 python3 /binary-srcs.pex venv --scope=srcs --compile /bin/app

FROM balenalib/raspberrypi4-64-debian:bullseye

...

COPY --from=deps /bin/app /bin/app
COPY --from=srcs /bin/app /bin/app

ENTRYPOINT ["/bin/app/pex"]
I'm seeing this issue
Copy code
exec /bin/app/pex: no such file or directory
The file certainly exists! My question is, if pants docker_image target does anything special to command or entrypoint? I certainly don't believe so..
If I override the entrypoint I get other issues 🤔
Like the pythonpath is special?
Copy code
root@881d71296eed:/# /bin/app/pex 
bash: /bin/app/pex: /bin/app/bin/python3.9: bad interpreter: No such file or directory
I recognize that this is how pex works. If I set PEX_PYTHON_PATH it doesn't override it
b
No, the pants target doesn't do anything special AFAIK
p
What I expected 😿 🤔
Executing a default zipapp pex works.
e
Your last FROM has a different base image - presumably with no Python or a different Python.
Venvs are virtual.
/bin/app/bin/python
(or one of the python* there) is a symlink to the original python3 in the different base image. No dice.
I'd look at the /bin/app/pex shebang and work backwards.
More generally though, I'd always just look. This is after all one of the things you can take solace in with a language as slow as Python. It's all just text or zips!