diff --git a/docs/reference/buildx_build.md b/docs/reference/buildx_build.md index 26908a40..b457f950 100644 --- a/docs/reference/buildx_build.md +++ b/docs/reference/buildx_build.md @@ -228,10 +228,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. @@ -244,18 +251,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 @@ -263,8 +279,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** @@ -274,8 +290,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) ```