Skip to main content

A simple Docker image builder and publisher

Project description

🐳 Docker Auto-Builder & Publisher

Python Version Docker License

A powerful, zero-config Python utility that automates the Docker image lifecycle: Build, Tag, and Push.

It seamlessly integrates with your Git workflow, supporting both remote repository cloning and local development contexts, with built-in auto-versioning capabilities.

✨ Key Features

  • 🚀 Remote Clone & Build: Point to any Git URL, and it handles the rest.
  • 📍 Local Context Detection: Run it inside your repo—it auto-detects the root and correct remote.
  • 🏷️ Smart Tagging:
    • Auto-infers image names from your git remote (e.g., git@github.com:user/appuser/app).
    • Auto-Versioning: Automatically bumps your semantic version (patch level) based on the latest Git tag.
  • 🔐 Flexible Auth: Authenticate via CLI arguments, Environment Variables, or existing local sessions.
  • 📜 Beautiful Logs: Clear, colored output to track your build progress.

🛠️ Installation

Option 1: Development Usage

If you want to contribute or modify the code:

  1. Set up the Environment:
    python3 -m venv .venv
    source .venv/bin/activate
    
    # Install runtime + dev dependencies
    pip install -e .[dev]
    
  2. Run directly:
    buildpub
    

Option 2: Install as a System Command (Recommended)

You can install this tool globally using pipx to run it from anywhere in an isolated environment.

  1. Install via pipx:

    pipx install buildpub
    

    Note: If you receive a warning about PATH, run pipx ensurepath to fix it.

  2. Run it from anywhere:

    buildpub
    

🚀 Quick Start

1. Build from your Current Directory (Local Mode)

The most common use case. Go to your project folder and run:

# This detects the git repo, infers the image name, and builds 'latest'
buildpub

2. Auto-Version Bump

Automatically detect the latest git tag (e.g., v1.0.2), bump it (to v1.0.3), build, and push.

buildpub --auto-version

3. Build a Remote Repository

Build a specific branch from a remote URL without cloning it manually.

buildpub \
  --repo https://github.com/Start Bootstrap/startbootstrap-clean-blog.git \
  --image myuser/clean-blog \
  --tag v2.0

⚙️ Usage Reference

buildpub [OPTIONS]

Core Arguments

Flag Description Default
--repo Git repository URL. If omitted, checks current directory. None (Local)
--image Target Image Name (e.g., user/repo). Auto-inferred if omitted. Inferred
--tag Specific tag to use. Overridden if --auto-version is set. latest
--auto-version (Flag) If set, bumps the latest git tag (patch version). False
--dockerfile Relative path to the Dockerfile. Dockerfile

Environment & Context

Flag Description Default
--branch Branch to checkout (Only for Remote Build). main
--build-arg Pass build arguments (can be used multiple times).
Example: --build-arg ENV=prod
None

Authentication

Flag Description Env Variable
--username Registry Username DOCKER_USERNAME
--password Registry Token/Password DOCKER_PASSWORD
--registry Registry URL (e.g., ghcr.io) None (Docker Hub)
--verbose (Flag) Enable verbose logging (INFO level). Default is ERROR only. False

Pro Tip: For CI/CD environments, use the Environment Variables DOCKER_USERNAME and DOCKER_PASSWORD instead of flags for better security.


📦 Examples

🔹 Basic Build & Push

buildpub --tag production

Builds current local code, pushes as {inferred_name}:production.

🔹 Custom Dockerfile & Args

buildpub \
  --dockerfile build/Dockerfile.prod \
  --build-arg APP_ENV=production \
  --tag v1.5

🔹 CI/CD Workflow (with Env Vars)

export DOCKER_USERNAME="myuser"
export DOCKER_PASSWORD="mysecrettoken"

buildpub --auto-version

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

buildpub-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

buildpub-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: buildpub-0.1.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for buildpub-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aebb2576fc4ce15e1a5e521335c5459ba98ad82f1dd5773afb16329e00cb6e2f
MD5 e66277dc762ad68c5fa805144a7771b0
BLAKE2b-256 1789f29d802523612d9d78998d835b50af4c32954fa669ae4945fb923e2cb32d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: buildpub-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for buildpub-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa86f8108ea9b0adfa9008dd015be123c9bed64fa10d383c2e1343e58eb3c76d
MD5 987285e92d0e7f227468db9be851fe6b
BLAKE2b-256 47fa8ee616ca9ea2eb0e08dfe92f36753f488c6207b37fe26ea2ee3e3e5e97a3

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