Hello! A quick plugin question - is it possible to...
# general
a
Hello! A quick plugin question - is it possible to supply input on stdin to a
Process
?
h
It is not, other than an
InteractiveProcess
where the user supplies that input What's the use case, if you're able to share?
a
i"m trying to containerize an application and I was thinking it'd be nice to pipe the dockerfile into
docker build
? I think I can write it out into the root of the process digest though?
h
I think I can write it out into the root of the process digest though?
Yeah, I would recommend doing that. To start, you can use `PathGlobs`: https://www.pantsbuild.org/docs/rules-api-file-system#pathglobs Likely more scalable for a docker plugin is to create a
docker
target type with a
sources
field https://www.pantsbuild.org/docs/rules-api-and-target-api#the-sources-field, which under-the-hood is using
PathGlobs
Then, you'll put this digest into
input_digest
on the Process, and your argv can refer to it becuase that file will be present in the chroot
Also check out #plugins if your'e not yet in it
a
neat thanks! I wasn't in that channel but I just joined
❤️ 1
that is what I landed on for copying the sources into the container but I was trying to figure out how to add the generated Dockerfile into the build context
h
Ah, there, you will use
To capture output files from the process, set output_files: Iterable[str] and/or output_directories: Iterable[str]. Then, you can use the ProcessResult.output_digest field to get a Digest of the result.
You likely need to then use
MergeDigests
to get a single digest from all the different ones you're accumulating
a
maybe I misunderstand but I don't think I want the dockerfile as an output - it's ephemoral & generated on the target. Then I'd want to run
docker build
as a process to create the image? Does that make sense
w
we could support propagating some fixed stdin to a
Process
locally, but it isn’t supported in remote execution… so yea, using a file is a good idea. it’s also possible to imitate it by spawning a shell and piping file contents into the process you’re trying to launch
👍 2