This package contains an implementation of a plugin for the pants build system to build docker images from pants build targets.
This plugin supports pantsbuild 2.13 and requires python >=3.8 to be installed, as well as transitively any other pants dependencies.
To install from pypi in an existing pantsbuild project add to your pants.toml file:
[GLOBAL] plugins = ["sendwave-pants-docker~=1.1"] backend_packages = ["sendwave.pants_docker"]
This plugin adds the ‘docker’ target that can be used with `pants package` to build a docker image. Ensure that you have docker installed & the daemon running when attempting to build an image.
The plugin will generate a Dockerfile & then then build that
dockerfile in a build context containing all dependent source files
(after stripping source roots). All source files will be copied into
the /application/
directory in the generated image.
Python requirements will be installed into a virtualenv in the docker image, which is activated by updating the PATH environment variable in the generated imaage.
See $ pants help docker
for information on possible values for the
docker target.
To add support for more targets in subsequent plugins (i.e. to
plug-into this plugin) add a rule mapping your Target/FieldSet to a
DockerComponent dataclass. Then add a
UnionRule(DockerComponentFieldSet, {YourRuleInput}
, the sources
in
the DockerComponent will be copied into the image and the commands
will be executed in the generated DockerFile.
- Fix too strict python interpreter version to allow any python version 3.8 or greater
- Update plugin for compatibility with pants version 2.13
- No user facing changes, but changes how lockfiles set via `requirement_constraints` are handled
- Remove pants level docker process caching - we will not cache the image generation results from one pants run to another.
- Log more information from the docker process
Initial Public Release
See COPYING for the text of the Apache License which governs this package.