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.1.tar.gz (10.2 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.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ngen_buildx-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 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.1.tar.gz
Algorithm Hash digest
SHA256 b36ee3882cc51b561bd0dad6dcbf4c5a2f1f66a9787be6c832d4dcd79fe92335
MD5 c47901235963774a53c578826b39b070
BLAKE2b-256 0404b7d7cd5cdbb3283d97bc2a00c82e582f92438efc52ac5ee123b721e9b3b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ngen_buildx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 816907f57e8d9108152944645ad54f0aaaa22d2f9f533c5c080107616a1c3c68
MD5 190a27585f7e845b80c017cf5e1db447
BLAKE2b-256 e423dbf5931292c3c23303693a036f9c9e546be2cf18100e87f436c4e1f61548

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