alert-beard-13327
10/14/2024, 7:55 PM.
āāā monorepo/
āāā .github/
ā āāā workflows/
ā āāā build_app1.yaml
ā āāā build_app2.yaml
āāā app/
ā āāā app1/
ā ā āāā app1/
ā ā ā āāā __init__.py
ā ā āāā Dockerfile
ā ā āāā pyproject.toml
ā ā āāā poetry.lock
ā āāā app2/
ā āāā app2/
ā ā āāā __init__.py
ā āāā Dockerfile
ā āāā pyproject.toml
ā āāā poetry.lock
āāā lib/
āāā lib1/
āāā lib1/
ā āāā __init__.py
āāā pyproject.toml
āāā poetry.lock
elegant-florist-94385
10/15/2024, 11:58 AMpython_source
targets (whether libs or app files mostly doesn't matter too much)
⢠Create a pex_binary
target that specifies the entrypoint file for your code
⢠In your dockerfile, COPY
the pex file (from /dist/something/whatever.pex
which is where the build artifact ends up)
⢠Now, when you do pants package /path/to/app1:app1_docker_image
(I made up a path/target name here). Pants will use its dependency inference techniques to find every python file depended on by your app1_entrypoint.py
(that you used for the pex_binary
), build them into an executable pex file, and copy them into your dockerfile.elegant-florist-94385
10/15/2024, 11:59 AMalert-beard-13327
10/15/2024, 4:05 PM