buildah icon indicating copy to clipboard operation
buildah copied to clipboard

Feature request: Support buildah shell scripts as custom syntax for `DOCKER_BUILDKIT=1 docker build`.

Open nl-brett-stime opened this issue 4 years ago • 7 comments

Recent versions of Docker support alternate syntaxes / front-ends for the docker build command when BuildKit is enabled: https://docs.docker.com/engine/reference/builder/#syntax

E.g., Given a file such as:

lighthttpd.buildahkit

# syntax = containers/buildahkit

ctr1=$(buildah from "${1:-fedora}")

## Get all updates and install our minimal httpd server
buildah run "$ctr1" -- dnf update -y
buildah run "$ctr1" -- dnf install -y lighttpd

## Include some buildtime annotations
buildah config --annotation "com.example.build.host=$(uname -n)" "$ctr1"

## Run our server and expose the port
buildah config --cmd "/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf" "$ctr1"
buildah config --port 80 "$ctr1"

## Commit this container to an image name
buildah commit "$ctr1" "${2:-$USER/lighttpd}"

...it could be built using Docker running on Linux, Mac, Windows, etc. using a command like the following:

DOCKER_BUILDKIT=1  docker build -f lighthttpd.buildahkit .

If I understand correctly, it seems like this can be accomplished by providing a mapping of buildah commands to Low-Level Builder (LLB) format that can be understood by a buildkit backend. Publishing the mapping as an image to Docker Hub would enable the usage publicly. More info: https://github.com/moby/buildkit#exploring-llb

It seems like this would be a good way to help people transition from Docker.

nl-brett-stime avatar Sep 03 '21 22:09 nl-brett-stime

@flouthoc @nl-brett-stime I am not sure what the request here is?

rhatdan avatar Sep 07 '21 18:09 rhatdan

@rhatdan : The request is to provide a gateway into the world of Buildah via Docker BuildKit and their support for alternate syntaxes in their build declaration files . It'll take some knowledge of both Buildah and BuildKit to pull it off but I think it'll benefit Buildah more than BuildKit e.g., making it easy to get started with Buildah from Mac and Windows.

nl-brett-stime avatar Sep 16 '21 17:09 nl-brett-stime

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Oct 17 '21 00:10 github-actions[bot]

@flouthoc PTAL Looks like Buildkit supports builtin arg passing for $1 and $2?

rhatdan avatar Oct 18 '21 18:10 rhatdan

@rhatdan I think @nl-brett-stime is trying to create a buildah specific syntax for buildkit. @nl-brett-stime Please correct me if i am wrong.

I think end result expectation from this issue is.

  • Buildkit to be able to read a valid .buildahkit file and actual build is performed via buildkit. So there is a inter-op between buildkit and buildah-cli commands.

flouthoc avatar Nov 15 '21 09:11 flouthoc

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Dec 16 '21 00:12 github-actions[bot]

@nl-brett-stime Any inputs on the comment above ? If my assumption is correct https://github.com/containers/buildah/issues/3497#issuecomment-968707184 I believe following issue should be opened against the buildkit/moby repo as well.

flouthoc avatar Dec 16 '21 09:12 flouthoc

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Nov 23 '22 00:11 github-actions[bot]

Since we never heard back, I am closing.

rhatdan avatar Nov 30 '22 20:11 rhatdan