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).
  • 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.6.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.6-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file build_q-0.1.6.tar.gz.

File metadata

  • Download URL: build_q-0.1.6.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for build_q-0.1.6.tar.gz
Algorithm Hash digest
SHA256 670b147859b15baf02f1901852ca231437876422c17fcfed3fad44ab8420b859
MD5 6bdf74f822dbc346ee158d23af15318a
BLAKE2b-256 8c487198451f43ef5f27ae6360ac17b60aa7b94467af96a24ebfcb566464ba66

See more details on using hashes here.

File details

Details for the file build_q-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: build_q-0.1.6-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.3

File hashes

Hashes for build_q-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5f2ffff7cf82aa6a89a3932924681af4fb05bed42f02c3727abe20b91552d94c
MD5 7bb4bb31859d23fb73f5d8d3f9c5a1c6
BLAKE2b-256 6a4d4e66de53c98ad9716f99b3a100fe131b93f94badd3b7024b75e16af5e9ec

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