From 0101c9653213fd0108b57d357f94c5b46c17048b Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 2 Aug 2021 11:05:21 +0200 Subject: [PATCH] Update cache docs Signed-off-by: CrazyMax --- docs/reference/buildx_build.md | 39 +++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 0bc1bab6..2e33e161 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -201,10 +201,17 @@ single-platform build result to `docker images`. --cache-from=[NAME|type=TYPE[,KEY=VALUE]] ``` -Use an external cache source for a build. Supported types are `registry` and `local`. -The `registry` source can import cache from a cache manifest or (special) image -configuration on the registry. The `local` source can import cache from local -files previously exported with `--cache-to`. +Use an external cache source for a build. Supported types are `registry`, +`local` and `gha`. + +- [`registry` source](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) +can import cache from a cache manifest or (special) image configuration on the +registry. +- [`local` source](https://github.com/moby/buildkit#local-directory-1) can +import cache from local files previously exported with `--cache-to`. +- [`gha` source](https://github.com/moby/buildkit#github-actions-cache-experimental) +can import cache from a previously exported cache with `--cache-to` in your +GitHub repository If no type is specified, `registry` exporter is used with a specified reference. @@ -217,18 +224,27 @@ $ docker buildx build --cache-from=user/app:cache . $ docker buildx build --cache-from=user/app . $ docker buildx build --cache-from=type=registry,ref=user/app . $ docker buildx build --cache-from=type=local,src=path/to/cache . +$ docker buildx build --cache-from=type=gha . ``` +More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache + ### Export build cache to an external cache destination (--cache-to) ``` --cache-to=[NAME|type=TYPE[,KEY=VALUE]] ``` -Export build cache to an external cache destination. Supported types are `registry`, -`local` and `inline`. Registry exports build cache to a cache manifest in the -registry, local exports cache to a local directory on the client and inline writes -the cache metadata into the image configuration. +Export build cache to an external cache destination. Supported types are +`registry`, `local`, `inline` and `gha`. + +- [`registry` type](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) exports build cache to a cache manifest in the registry. +- [`local` type](https://github.com/moby/buildkit#local-directory-1) type +exports cache to a local directory on the client. +- [`inline` type](https://github.com/moby/buildkit#inline-push-image-and-cache-together) +type writes the cache metadata into the image configuration. +- [`gha` type](https://github.com/moby/buildkit#github-actions-cache-experimental) +type exports cache through the [Github Actions Cache service API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication). `docker` driver currently only supports exporting inline cache metadata to image configuration. Alternatively, `--build-arg BUILDKIT_INLINE_CACHE=1` can be used @@ -236,8 +252,8 @@ to trigger inline cache exporter. Attribute key: -- `mode` - Specifies how many layers are exported with the cache. “min” on only -exports layers already in the final build stage, “max” exports layers for +- `mode` - Specifies how many layers are exported with the cache. `min` on only +exports layers already in the final build stage, `max` exports layers for all stages. Metadata is always exported for the whole build. **Examples** @@ -247,8 +263,11 @@ $ docker buildx build --cache-to=user/app:cache . $ docker buildx build --cache-to=type=inline . $ docker buildx build --cache-to=type=registry,ref=user/app . $ docker buildx build --cache-to=type=local,dest=path/to/cache . +$ docker buildx build --cache-to=type=gha . ``` +More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache + ### Allow extra privileged entitlement (--allow) ```