-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[builder] add docker buildx bake as a builder #43
Comments
kbld just calls docker build CLI command. layer caching is done by docker itself so no work for us there.
hmm, i havent really looked at docker buildx bake, i probably should. one of the goals for kbld was to wrap familiar building tools (docker build, pack build) so that they can be more easily used in a dev/prod workflow. i could see integration with buildx, but i havent personally used it so dont have opinion how best use it. is it more effecient compared to plain docker build? |
Just FYI that docker buidkit is not enabled by default in the
AFAIK It's a higher level semantics to express a number of images to build and possibly tags for them, which is similar to the syntax you provide. It uses docker buildx under the covers. But yes, if you are building more than one image it's more efficient than docker build. However, I just started using it a month or so ago and would refer to maybe @tonistiigi to give more details. |
do you typically write out something like this (https://github.com/data-apis/python-record-api/blob/4fa06df6c0eac85e9f54d70f7172dde9e1ef3125/k8/Makefile#L123-L169) and feed it into bake command? if so it sounds like this might be an interesting backend for kbld (as an alternative to docker build and pack backends) for more advanced users of docker. i could imagine instead of taking Dockerfile it could find file x and call out to docker buildx bake. then grab images that were built. (im not sure how that would fit though with making a "single" build graph from multiple image sources though). |
Yeah. Here is the generated JSON, which is a bit easier to reason about: {
"group": {
"default": {
"targets": [
"dask",
"matplotlib",
"networkx",
"pandas",
"sample-usage",
"scipy",
"skimage",
"sklearn",
"xarray"
]
}
},
"target": {
"base-base": {
"dockerfile": "Dockerfile"
},
"base": {
"context": "images/base",
"inherits": [
"base-base"
],
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/base:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/base:cache"
],
"args": {
"PYTHON_PACKAGE_VERSION": "1.2.1"
},
"tags": [
"registry.digitalocean.com/python-record-api/base:1.2.1-0"
]
},
"xarray": {
"context": "images/xarray",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/xarray:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/xarray:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/xarray:1.2.1-0-1"
]
},
"sklearn": {
"context": "images/sklearn",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/sklearn:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/sklearn:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/sklearn:1.2.1-0-1"
]
},
"skimage": {
"context": "images/skimage",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/skimage:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/skimage:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/skimage:1.2.1-0-1"
]
},
"scipy": {
"context": "images/scipy",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/scipy:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/scipy:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/scipy:1.2.1-0-0"
]
},
"sample-usage": {
"context": "images/sample-usage",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/sample-usage:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/sample-usage:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/sample-usage:1.2.1-0-0"
]
},
"pandas": {
"context": "images/pandas",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/pandas:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/pandas:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/pandas:1.2.1-0-1.1.0-1"
]
},
"networkx": {
"context": "images/networkx",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/networkx:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/networkx:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/networkx:1.2.1-0-7"
]
},
"matplotlib": {
"context": "images/matplotlib",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/matplotlib:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/matplotlib:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/matplotlib:1.2.1-0-1"
]
},
"dask": {
"context": "images/dask",
"inherits": [
"base-base"
],
"args": {
"FROM": "registry.digitalocean.com/python-record-api/base:1.2.1-0"
},
"cache-to": [
"type=registry,ref=registry.digitalocean.com/python-record-api/dask:cache,mode=max"
],
"cache-from": [
"type=registry,ref=registry.digitalocean.com/python-record-api/dask:cache"
],
"tags": [
"registry.digitalocean.com/python-record-api/dask:1.2.1-0-1"
]
}
}
} They also support some HCL version of the file, to generate this JSON as well, but I needed more flexibility than that, so I just switched to using jq generate the JSON instead. |
👍 im going to keep this issue open for anyone who may be interested in contributing support for this type of builder. |
related: added |
First off, I wanted to say thank you for putting together this tool. The ability to specify local build context and have they transformed into images is great!
I have been using Docker buildx bake as a similar tool, using the Kubernetes executor to build images on k8 and push images.
I have been appreciating the ability to parallelize the build DAG as well as add caching for certain steps easily. See my generated docker bake json, for an example of the caching and tags.
So I am curious about two points:
These are larger discussion points, so I more just wanted to get a sense from you all how you are thinking about the relationship between the two tools.
I am very thankful that there is so much great work going on this space right now!
The text was updated successfully, but these errors were encountered: