Docker Buildkit Pulumi Provider
A Pulumi provider that builds and pushes a Docker image to a registry using Buildkit.
Motivation
Why use this provider over the official pulumi-docker provider? This provider fixes many of the bugs with the official Docker provider:
pulumi previewdoes not silently block while waiting for the Docker image to build.- Output from
docker buildstreams to the terminal duringpulumi up. docker buildis not invoked if nothing in the build context has changed.- Changes to the build context cause a diff to appear during
pulumi preview.
It also provides several new features:
- Support for cross-building images (e.g., building a
linux/arm64image on alinux/amd64host.) - Automatic inline caching.
There are a few limitations though. The Image resource is much less
configurable than the
Image resource in
the official Docker provider. And there is no support whatsoever for the other
resource types, like Container or Secret.
Usage example
To build and push an image to an AWS ECR repository:
import base64
import pulumi
import pulumi_aws as aws
import pulumi_docker_buildkit as docker_buildkit
def get_registry_info(registry_id):
credentials = aws.ecr.get_credentials(registry_id)
username, password = base64.b64decode(credentials.authorization_token).decode().split(":")
return docker_buildkit.RegistryArgs(
server=credentials.proxy_endpoint,
username=username,
password=password,
)
repo = aws.ecr.Repository("repo")
image = docker_buildkit.Image(
"image",
name=repo.repository_url,
registry=repo.registry_id.apply(get_registry_info),
)
Warning: Be sure to aggressively exclude files in your .dockerignore. The
Image resource hashes all files in the build context before determining
whether to invoke docker build. This is fast, unless you have tens of
thousands of files in your build context. The .git directory and
node_modules are the usual culprits.
Metadata
Release files for pulumi-docker-buildkit 0.1.27
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pulumi_docker_buildkit-0.1.27.tar.gz | 9.4 kB | Without provenance | Details for pulumi_docker_buildkit-0.1.27.tar.gz |
Release files / pulumi_docker_buildkit-0.1.27.tar.gz
| Download URL | pulumi_docker_buildkit-0.1.27.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
266f30d1a213d13cd49e1b382c894a5fd252a37d8c7d82f5016df77f42e3538a
|
|
BLAKE2b-256 checksum How to use checksums |
042eec91f64383f40326143ffc7c81fd540207a86a4396685b0bbdbf34ac5bd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for pulumi-docker-buildkit 0.1.27
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.