2 ms·
I would say check out buildkit, which is the tech behind "docker build"'s new builder. I don't know if the Dockerfile format is really suitable for this, but y
by cpuguy83 8y ago
I would say check out buildkit, which is the tech behind "docker build"'s new builder.
I don't know if the Dockerfile format is really suitable for this, but you can now build your own format and Docker can just build it.
Basically buldkit breaks things down into a frontend format (like Dockerfile) and a frontend parser which gets specified as an image at the top of your file (`#syntax=<some image>`), the parser converts the frontend format into an intermediary language (called llb), buildkit takes the llb and passes it to a backend worker.
This all happens behind the scenes with `DOCKER_BUILDKIT=1 docker build -t myImage .`
Docker actually ships new Dockerfile features that aren't tied to a docker version this way.
Actually there are a number of new Dockerfile features that might get you what you need, even if the format isn't all that great, at least it's relatively natural to reason about.
Things like cache mounts, secrets, mounting (not copying) images into a build stage's "RUN" directive, lots of great stuff.
This is all officially supported stuff.
Here's a demo of "docker build" building from a buildpack spec instead of Dockerfile: https://github.com/tonistiigi/buildkit-pack https://github.com/tonistiigi/buildkit-pack
- buildkit - https://github.com/moby/buildkit https://github.com/moby/buildkit
- official Docker docs - https://docs.docker.com/develop/develop-images/build_enhancements/ https://docs.docker.com/develop/develop-images/build_enhance...
- buildkit Dockerfile docs - https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md https://github.com/moby/buildkit/blob/master/frontend/docker...