buildahscript

A more dynamic container builder

Buildahscript is a new container definition language built to be imperative and flexible.

It allows you to do more with buildargs, create actually re-usable modules, and in general create more flexible containers.

Why Buildahscript?

Traditional Dockerfiles have limitations that can make it hard to express some things succintly, especially around buildargs. If you would like to do these things, you should look at using buildahscript instead:

What does it look like?

Here’s a port of the xonsh Dockerfile

#| arg: variant
#| arg: version

dashvariant = f"-{variant}" if variant else ""
specifier = f"=={version}" if version else ""

with container(f"python:3{dashvariant}") as cnt:
    cnt.run([
        'pip', 'install', '--no-cache-dir',
        '--disable-pip-version-check',
        f'xonsh[linux]{specifier}',
    ])
    with cnt.mount() as root:
        (root / "usr" / "bin" / "xonsh").symlink_to('/usr/local/bin/xonsh')

    cnt.command = ['/usr/bin/xonsh']
    cnt.labels.update({
        "repository": "http://github.com/xonsh/container",
        "homepage": "https://xon.sh/",
        "maintainer": "Jamie Bliss <jamie@ivyleav.es>",
    })

    return cnt.commit()

Installation

  1. Install Buildah
  2. Install buildahscript with Pip ($ pip3 install --user buildahscript)

License

Buildahscript is made available publically under the Prosperity License. Commercial Licenses are available via licensezero

Projects