Pants: Docker integration

Created on 1 Dec 2015  路  3Comments  路  Source: pantsbuild/pants

Hi,

I searched into the docs and issues and did not see any mention about that. It would be awesome to have some integration with Docker, e.g., to allow to create images from actual rules and push them to some registry. Is this in your roadmap?

Thanks.

Q42020-idea user reported

Most helpful comment

Hey there, I figured I'd add my wishlist for a docker plugin if it helps.

For context, my team's monorepo is mostly python with a combination of CLI apps, web services, and libraries. The apps and services run in docker containers, either as standalone k8s deployments (for web services) or as steps in argo workflows (for apps). We use skaffold to build and deploy our images and helm for templating.

With this in mind, I was interested in the bazel docker rules because they move container image building into the build tool and treat images as output artifacts of the build process. I ended up passing on bazel, so I'm currently working on implementing pants in our repo as a proof of concept but I am hung up on the best way to output docker image artifacts.

Right now, in order to get pants working, I made a single root Dockerfile which builds all of the targets with pants, then I have a target and a COPY --from for each app and service. The problem is that I need to run all of the pants goals during the docker build (with the full monorepo context) and I've already run into an issue where a couple of tests run fine locally but fail/timeout (after 30m) during docker build. I could possibly run pants locally and just copy the artifacts into the docker image, but I'm not quite sure how I would verify the pants output during the docker build step.

So in short I guess I'd like the pants docker plugin to mimic that bazel one while also working with skaffold's custom build command.

All 3 comments

I've put out a third party plugin for docker if people are looking for one: https://github.com/toddgardner/pants-plugins

I'm bumping this ticket because it was raised during the Q4 2020 feedback gathering session (whee how time flies!).

Unfortunately, @toddgardner's plugin will not work with Pants v2. There are at least two "types" of docker integration (running processes in docker, publishing docker images), but since they're likely to interact to some degree, we'll continue to use this ticket as the place to aggregate those ideas.

Hey there, I figured I'd add my wishlist for a docker plugin if it helps.

For context, my team's monorepo is mostly python with a combination of CLI apps, web services, and libraries. The apps and services run in docker containers, either as standalone k8s deployments (for web services) or as steps in argo workflows (for apps). We use skaffold to build and deploy our images and helm for templating.

With this in mind, I was interested in the bazel docker rules because they move container image building into the build tool and treat images as output artifacts of the build process. I ended up passing on bazel, so I'm currently working on implementing pants in our repo as a proof of concept but I am hung up on the best way to output docker image artifacts.

Right now, in order to get pants working, I made a single root Dockerfile which builds all of the targets with pants, then I have a target and a COPY --from for each app and service. The problem is that I need to run all of the pants goals during the docker build (with the full monorepo context) and I've already run into an issue where a couple of tests run fine locally but fail/timeout (after 30m) during docker build. I could possibly run pants locally and just copy the artifacts into the docker image, but I'm not quite sure how I would verify the pants output during the docker build step.

So in short I guess I'd like the pants docker plugin to mimic that bazel one while also working with skaffold's custom build command.

Was this page helpful?
0 / 5 - 0 ratings