Besides utilizing pex binaries, is there a way to ...
# general
p
Besides utilizing pex binaries, is there a way to export locked python requirements (right now there's a few scripts with different BUILD files that list out requirements in
python_requirement
that share a resolve) from a resolve so they can be installed inside a Docker image? We were trying to avoid methods where Python/assembled is built outside Docker since we were running into platform/architecture issues (which required layering environments on top)
h
e
You'll have to either 1. Build/resolve your requirements outside of the container, then copy into the image (eg. as a pex) a. I do understand this is giving you a bit of grief due to platform/architecture 2. Build/resolve your requirements inside the container a. Probably you would want to do this using a multistage build i. Copy most/all of your repo into the container ii. install pants iii. export your resolve/venv iv. In a new build stage, COPY the relevant files from the venv
p
yeah, i saw
export
but looks like best I can do is relocatable venv which will 100% break with Docker COPY (platform, arch, glib vs musl)
Might give pex another shot at some point, I think it was working but a little clunky since it forced everything on macos into x86_64 Linux Docker VM which isn't very fast (otherwise there were locking issues with macos vs linux platform and certain Python modules that ship binaries)
Really our current setup is abusing the lack of requirements working w/ Docker image so they're resolved separately inside Docker build outside pants lock so local dev gets either mac/linux arm and CI gets linux 64 (variant of python whls)