Skip to main content

Docker Buildx CLI wrapper with GitOps integration

Project description

ngen-buildx

Docker Buildx CLI wrapper with GitOps integration.

Overview

ngen-buildx is a CLI tool that simplifies Docker image building using docker buildx. It integrates with ngen-gitops to automatically fetch CI/CD configuration from repositories.

Features

  • 🚀 GitOps Integration: Fetches cicd/cicd.json from repositories using gitops get-file
  • 🔧 Configurable Build Args: Template-based build arguments with variable substitution
  • 📦 Resource Management: Configurable memory and CPU limits for builds
  • 🏗️ Multi-platform Support: Build for multiple architectures

Installation

pip install ngen-buildx

Prerequisites

  • Docker with buildx plugin installed
  • ngen-gitops installed and configured with Bitbucket credentials

Quick Start

  1. Initialize configuration:

    buildx init
    
  2. Edit configuration files:

    # Edit ~/.ngen-buildx/.env for environment variables
    # Edit ~/.ngen-buildx/arg.json for build arguments
    
  3. Build an image:

    buildx build saas-apigateway develop
    

Configuration

Environment Variables (~/.ngen-buildx/.env)

# Builder Configuration
BUILDER_NAME=mybuilder
DEFAULT_MEMORY=4g
DEFAULT_CPU_PERIOD=100000
DEFAULT_CPU_QUOTA=200000

# Registry Configuration
REGISTRY01_URL=registry.example.com

Build Arguments (~/.ngen-buildx/arg.json)

{
    "REGISTRY01": "$REGISTRY01_URL",
    "BRANCH": "$REFS",
    "PROJECT": "$IMAGE",
    "PORT": "$PORT",
    "PORT2": "$PORT2"
}

CICD Configuration (cicd/cicd.json in repository)

{
    "IMAGE": "saas-apigateway",
    "CLUSTER": "qoin",
    "PROJECT": "saas",
    "DEPLOYMENT": "saas-apigateway",
    "NODETYPE": "front",
    "PORT": "8005"
}

Usage

Build Command

# Basic build
buildx build <repo> <ref>

# Examples
buildx build saas-apigateway develop
buildx build saas-apigateway develop --dry-run
buildx build saas-apigateway develop --push
buildx build myrepo main --tag myregistry/myapp:v1.0.0
buildx build myrepo main --platform linux/amd64,linux/arm64

Options

Option Description
--context Build context path (default: .)
--dockerfile, -f Dockerfile path (default: Dockerfile)
--tag, -t Image tag
--push Push image after build
--platform Target platform(s)
--org Organization name
--dry-run Show command without executing
--json Output as JSON

Configuration Command

# Show configuration
buildx config

# Show as JSON
buildx config --json

Initialize Command

# Create config files
buildx init

# Recreate config files
buildx init --force

Generated Build Command

The tool generates a command like:

docker buildx build \
  --builder mybuilder \
  --sbom=true \
  --no-cache \
  --attest type=provenance,mode=max \
  --memory 4g \
  --cpu-period 100000 \
  --cpu-quota 200000 \
  --progress=plain \
  --build-arg REGISTRY01=registry.example.com \
  --build-arg BRANCH=develop \
  --build-arg PROJECT=saas-apigateway \
  --build-arg PORT=8005 \
  --build-arg PORT2=8080 \
  -f Dockerfile \
  .

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

ngen_buildx-0.1.2.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

ngen_buildx-0.1.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file ngen_buildx-0.1.2.tar.gz.

File metadata

  • Download URL: ngen_buildx-0.1.2.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ngen_buildx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 84bc85d2b9dacc49c2c65eaf22a3396e566c9db2451800693256d4da55a8fa30
MD5 3d2f54930865426051e92b97ef3417c5
BLAKE2b-256 036065446aa15a35c6430a71f9d6fc44e5b78b2c9899dd6c34590810b404fe93

See more details on using hashes here.

File details

Details for the file ngen_buildx-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ngen_buildx-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for ngen_buildx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de4ea0d5fdf547036982ccd325e3bda9bd8bb9253d8083cd6a35fba07167780e
MD5 db0a6234c6075843645f800712ee70ab
BLAKE2b-256 a3815fc65d19b5e7354355db71153b82f62e2852228ee54c8cbc9e6457d7bd29

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