melodic-knife-23027
07/24/2024, 3:33 PMdocker_image
as a dependency in a python script. I've written a script for deploying my application and I would like to use pants to build and run the deployment script in one step. At the moment I'm looking at runtime_package_dependencies
in python_test
but there doesn't seem to be an equivalent for python_source
unless I'm missing something. Additionally, it's not clear to me how to obtain the digest of the image built by the corresponding pants publish
command. I'll potentially be running multiple of these in parallel and don't want to rely on fixed tags.broad-processor-92400
07/24/2024, 11:15 PMAdditionally, it's not clear to me how to obtain the digest of the image built by the correspondingMetadata about the image is output as a JSON file, if you runcommandpants publish
pants package path/to:image
you can see it in your dist/
folder I think.
At the moment I'm looking atUnfortunately I don't think you're missing something. I believe one thing people do is build an orchestration binary that itself runs Pants, e.g.inruntime_package_dependencies
but there doesn't seem to be an equivalent forpython_test
unless I'm missing somethingpython_source
pants package path/to:run-my-deploy && dist/path.to/run-my-deploy.pex
or similar schemes along those lines. Might that work for you?melodic-knife-23027
07/24/2024, 11:19 PMdocker_image(
...
image_tags=["{build_args.INVOCATION_UUID}"]
)
And in my python run script:
# Build the docker image for this run.
with tempfile.NamedTemporaryFile() as publish:
await execute_and_stream(
f"pants publish {_docker_target.value} --publish-output={publish.name}",
env=os.environ | {
"PANTS_CONCURRENT": "True",
"INVOCATION_UUID": uuid.uuid4().hex,
},
cwd=os.environ["PWD"])
build_result = json.load(publish)