Skip to main content

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/.netrc as a build secret (id=netrc).
  • Default Platform: Defaults to --platform linux/amd64 for all builds.
  • Smart Branch Detection: Sets BRANCH=production for tags starting with v*, and BRANCH=develop otherwise.
  • CI/CD Integration: Integrates with cicd/cicd.json for 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:

  1. Bumps the version in pyproject.toml and build_q/__init__.py.
  2. Builds the source and wheel distributions.
  3. 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

build_q-0.1.8.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

build_q-0.1.8-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

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

Hashes for build_q-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d946acfbd38c71c3af3f12289901d1871a14bb78109aae96ea69ae7f3dc5ca9e
MD5 537035e2b3dcaa31fe732cd51b6766d8
BLAKE2b-256 3a6163da41fdc3c33055d9751a89ed5e6de11e64d2393df0171ee65191e9a212

See more details on using hashes here.

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

Hashes for build_q-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ed352551a9ee2abdfeb1f0606afb3ab817b636bbefe8c2844243fa9c0d96127e
MD5 fd7fe8600de27e45fa83981b222451c7
BLAKE2b-256 81cefabc720cb2220721a34bc0d000456b19eadf8f76b0025a2437243f8d393c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page