Simple Docker Buildx CLI for local builds
Project description
build-q (bq) 🚀
build-q (pronounced bq) is a lightweight, zero-dependency Python CLI tool for streamlined local Docker Buildx operations. It auto-detects repository info from Git and reads local cicd/cicd.json to mirror production-ready builds on your local machine.
🛠 Features
- Zero-Dependency: No external Python libraries required (only standard library).
- Git Auto-detection: Automatically identifies repo name and branch/tag from your current directory.
- Resource Management: Pre-configured defaults for memory and CPU limits to keep your machine responsive.
- Auto-push: Images are pushed to the registry by default after a successful build.
- Image Check: By default, verifies if the image already exists in the registry to avoid redundant builds (disable with
--no-image-check). - Default Secrets: Automatically includes
$HOME/.netrcas a build secret (id=netrc). - Default Platform: Defaults to
--platform linux/amd64for all builds. - Smart Branch Detection: Sets
BRANCH=productionfor tags starting withv*, andBRANCH=developotherwise. - CI/CD Integration: Integrates with
cicd/cicd.jsonfor shared build arguments.
📦 Installation
To install build-q globally on your system, it is recommended to use pipx (or pip):
pipx install build-q
Atau melalui pip:
pip install build-q
This will provide two commands: build-q and the shorthand bq.
🚀 Usage
Simple Build (Auto-detected)
Run this inside a git repository to auto-detect the service name and branch:
bq --local
Explicit Build
bq my-service staging --local --push
Full Example (Customizing defaults)
bq plus-be-service staging \
--secret id=custom,src=/path/to/secret \
--platform linux/amd64 \
--local --no-push \
--build-arg BRANCH=custom-branch
Dry Run
Check what command will be executed without actually running it:
bq my-service develop --local --dry-run
⚙️ Configuration
Initialize your local configuration file:
bq --init
This creates a config file at ~/.build-q/.env. You can edit this file to set your default registry URL and resource limits.
Configuration Options
| Variable | Description | Default |
|---|---|---|
BUILDER_NAME |
Name of the Docker Buildx builder | mybuilder |
REGISTRY_URL |
Default container registry URL | registry.example.com |
DEFAULT_MEMORY |
Memory limit for builds | 4g |
DEFAULT_CPU_PERIOD |
CPU period limit | 100000 |
DEFAULT_CPU_QUOTA |
CPU quota limit | 200000 |
🚀 Automation & Release
The project includes a Makefile for streamlined building and releasing to PyPI.
Build
To build the distribution packages:
make build
Release
To release a new version (automatically bumps the patch version, e.g., 0.1.0 -> 0.1.1):
make release
To specify a version explicitly:
make release V=1.0.0
The release process:
- Bumps the version in
pyproject.tomlandbuild_q/__init__.py. - Builds the source and wheel distributions.
- Uploads to PyPI using
twine.
📋 Requirements
- Python 3.7+
- Docker with Buildx plugin
- Git (optional, for auto-detection)
📄 License
MIT
Project details
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 build_q-0.1.8.tar.gz.
File metadata
- Download URL: build_q-0.1.8.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d946acfbd38c71c3af3f12289901d1871a14bb78109aae96ea69ae7f3dc5ca9e
|
|
| MD5 |
537035e2b3dcaa31fe732cd51b6766d8
|
|
| BLAKE2b-256 |
3a6163da41fdc3c33055d9751a89ed5e6de11e64d2393df0171ee65191e9a212
|
File details
Details for the file build_q-0.1.8-py3-none-any.whl.
File metadata
- Download URL: build_q-0.1.8-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed352551a9ee2abdfeb1f0606afb3ab817b636bbefe8c2844243fa9c0d96127e
|
|
| MD5 |
fd7fe8600de27e45fa83981b222451c7
|
|
| BLAKE2b-256 |
81cefabc720cb2220721a34bc0d000456b19eadf8f76b0025a2437243f8d393c
|