So, Trying to build a simplistic docker plugin to ...
# plugins
a
So, Trying to build a simplistic docker plugin to build a docker image using a
Dockerfile
, files from any other unbuilt dependencies, a and the outputs of other
package
targets. (minimal requirement is a
.pex
file, and a
.sh
script built into an image) Have gotten the latter working and running
find
inside a chroot reveals the
.pex
file (great!)
Copy code
.
./examples.docker_image
./examples.docker_image/hello-world.pex'
Struggling to get the former bits working, and I've tried enough things from the examples in the docs I'm a bit lost. WIP code here: https://github.com/xlevus/pants2-plugins/pull/1/files
f
https://github.com/pantsbuild/pants/pull/12363 there is already work around adding Docker support to Pants
target is there along with the lint step https://github.com/pantsbuild/pants/pull/12426
a
oh.
h
Hey @ambitious-actor-36781! Did you see @curved-television-6568 has started adding Docker support to Pants 2.7? It may do what you'd like and/or be inspiration for your plugin. Andreas might also love extra help on it if you're interested in contributing to that effort 🙂 even if not writing code, reviewing it would be super helpful. One of the hardest parts of Docker support is nailing down what it really means another thing to check is @average-australia-85137's plugin at https://github.com/compyman/pants-docker For finding Docker, I recommend you use
BinaryPaths
. Start w/ getting
docker --version
to work https://www.pantsbuild.org/docs/rules-api-installing-tools#binarypaths-find-already-installed-binaries
@fresh-cat-90827 coke(aka jinx)
😁 1
a
feels like it's gonna be easier to wait
h
What functionality are you looking for?
a
minimal requirement is a .pex file, and a .sh script built into an image. Which looks like is pretty much done in Andreas' first PR
👍 2
although, I feel I'm 90% there... Just need to work out why I can't seem to collect the sources
Copy code
transitive_targets = await Get(TransitiveTargets, Addresses([field_set.address]))
which is in pretty much all examples is what's failing.
with a good 200 errors
h
Use TransitiveTargetsRequest as the second arg. Big oof if we didn't update all the examples in the docs :/
a
oof
Copy code
b'.
./examples.docker_image
./examples.docker_image/hello-world.pex
./examples
./examples/docker_image
./examples/docker_image/Dockerfile'
🎉
h
Yay! Where were the examples stale? (Docs suggestions appreciated with the top right corner's "suggest edits" if you have a chance)
a
all of them I think
h
Okay I'll audit it tomorrow. I thought I had updated this all, although ik the example-plugin repo uses an older version of Pants
w
sorry for the nasty error messages. have made progress on a refactor of rule graph building that should make that situation much better.
a
https://github.com/xlevus/pants2-plugins 🎉 it basic as heck but it works, and is (mostly) sufficient.