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.
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:
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()
buildahscript
with Pip ($ pip3 install --user buildahscript
)Buildahscript is made available publically under the Prosperity License. Commercial Licenses are available via licensezero
buildahscript-py: An environment for building containers with buildah (Python version)
buildahscript.github.io: buildahscript site