Skip to content

compyman/pants-docker

Repository files navigation

Sendwave Pants Docker Plugin

Version 1.1.1

This package contains an implementation of a plugin for the pants build system to build docker images from pants build targets.

Requirements

This plugin supports pantsbuild 2.13 and requires python >=3.8 to be installed, as well as transitively any other pants dependencies.

Installation

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"]

Overview

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.

ChangeLog

1.1.1

  • Fix too strict python interpreter version to allow any python version 3.8 or greater

1.1.0

  • Update plugin for compatibility with pants version 2.13
  • No user facing changes, but changes how lockfiles set via `requirement_constraints` are handled

1.0.1

  • 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

1.0

Initial Public Release

License

See COPYING for the text of the Apache License which governs this package.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •