Build Docker images for use in Kubernetes deployments
Project description
buildimage
Build Docker images for use in Kubernetes deployments. The build images can be tagged with configurable values. The recomended way is to tag it with the tree hash from the docker folder. This is the way the example below use.
The script uses a file named images.yaml to describe what images to build and what deployments to patch with new tags. Built images will also have some labels with metadata defined. The YAML file can use facts using the Jinja2 template format {{ name }}.
Installation
Install from PyPI:
pip install buildimage
Usage
Run the buildimage command in a directory containing an images.yaml file or specify the directory as an argument:
buildimage [OPTIONS] DIRECTORY
Options
--nopush: Skip pushing built images--image IMAGE: Only build named images (can be specified multiple times)DIRECTORY: Path to directory containing theimages.yamlfile (default: current directory)
Configuration
Create an images.yaml file in your project root with the following format:
images:
- directory: "build-directory"
name: "image name"
tags:
- "tree-{{ treeHash }}"
labels:
- name: com.mydomain.repository
value: "{{ repository }}"
buildArgs:
- name: "build-arg-name"
value: "build-arg-value"
deployments:
- path: "path/to/deployment.yaml"
match: "regex-to-match"
replace: "replacement-value"
Available Facts
The following facts are available for templating in images.yaml:
{{ branch }}: Current Git branch{{ remote }}: Git remote name{{ repositoryFull }}: Full repository URL{{ repository }}: Repository URL without user info{{ commit }}: Hash for current HEAD commit{{ topTreeHash }}: Git tree hash of the top directory{{ treeHash }}: Git tree hash of the image directory (per image){{ top }}: Top directory path
Example
See the tests/docker/ directory for a complete example with test images and deployment updates.
License
GNU Lesser General Public License v3.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file buildimage-1.0.0.tar.gz.
File metadata
- Download URL: buildimage-1.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75f4070e57d4d0751d1412687eadc2ad06d0a75aa7cdce83eb217cac27ca5f81
|
|
| MD5 |
22e814a72bd7a2e9e56480f2215bb928
|
|
| BLAKE2b-256 |
8158358bafbff13b8f1ca47e9965e0e9f3209e635eb9fddafc0859e22388f0fd
|
File details
Details for the file buildimage-1.0.0-py3-none-any.whl.
File metadata
- Download URL: buildimage-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89ae9adf435d9f13463258dd8067ffe220ca1081b02005f56e9cabf6bbf97e63
|
|
| MD5 |
fd2fd9784a5da87c2a9a246868b999be
|
|
| BLAKE2b-256 |
729048bae4f07fe708b1710dff22a392b7fad0f236bbce6eddea770029b04596
|