2021-01-28 23:14:03 +01:00
[](https://github.com/docker/bake-action/releases/latest)
2020-10-08 00:52:52 +02:00
[](https://github.com/marketplace/actions/docker-buildx-bake)
2022-12-19 20:39:40 +01:00
[](https://github.com/docker/bake-action/actions?workflow=ci)
[](https://github.com/docker/bake-action/actions?workflow=test)
2021-01-28 23:14:03 +01:00
[](https://codecov.io/gh/docker/bake-action)
## :test_tube: Experimental
2022-10-07 16:41:51 +02:00
This repository is considered **EXPERIMENTAL** and under active development
until further notice. It is subject to non-backward compatible changes or
removal in any future version, so you should [pin to a specific tag/commit ](https://docs.github.com/en/actions/creating-actions/about-actions#using-tags-for-release-management )
of this action in your workflow (i.e `docker/bake-action@v1.1.3` ).
2020-10-08 00:52:52 +02:00
## About
2022-10-07 16:41:51 +02:00
GitHub Action to use Docker [Buildx Bake ](https://docs.docker.com/build/customize/bake/ )
2021-04-03 20:37:29 +02:00
as a high-level build command.
2020-10-08 00:52:52 +02:00
2021-05-26 15:22:18 +02:00

2020-10-08 00:52:52 +02:00
___
* [Usage ](#usage )
* [Customizing ](#customizing )
* [inputs ](#inputs )
2021-09-01 22:22:37 +02:00
* [outputs ](#outputs )
2022-10-07 16:41:51 +02:00
* [Contributing ](#contributing )
2020-10-08 00:52:52 +02:00
## Usage
```yaml
name: ci
2021-04-03 20:37:29 +02:00
2020-10-08 00:52:52 +02:00
on:
push:
2021-04-03 20:37:29 +02:00
branches:
- 'master'
2020-12-23 20:15:23 +01:00
2020-10-08 00:52:52 +02:00
jobs:
bake:
runs-on: ubuntu-latest
steps:
-
name: Checkout
2022-05-28 18:35:39 +02:00
uses: actions/checkout@v3
2020-10-08 00:52:52 +02:00
-
name: Set up Docker Buildx
2022-05-05 19:40:03 +02:00
uses: docker/setup-buildx-action@v2
2020-10-08 00:52:52 +02:00
-
name: Login to DockerHub
2022-05-05 19:40:03 +02:00
uses: docker/login-action@v2
2020-10-08 00:52:52 +02:00
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
2023-04-18 09:19:26 +02:00
uses: docker/bake-action@v3
2020-10-08 00:52:52 +02:00
with:
2020-12-23 20:15:23 +01:00
push: true
2020-10-08 00:52:52 +02:00
```
## Customizing
### inputs
Following inputs can be used as `step.with` keys
2020-12-23 23:44:52 +01:00
> `List` type is a newline-delimited string
2020-10-08 00:52:52 +02:00
> ```yaml
> set: target.args.mybuildarg=value
> ```
> ```yaml
> set: |
> target.args.mybuildarg=value
> foo*.args.mybuildarg=value
> ```
2020-12-23 23:44:52 +01:00
> `CSV` type is a comma-delimited string
> ```yaml
> targets: default,release
> ```
2023-03-13 14:37:07 +01:00
| Name | Type | Description |
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `builder` | String | Builder instance (see [setup-buildx ](https://github.com/docker/setup-buildx-action ) action) |
| `files` | List/CSV | List of [bake definition files ](https://docs.docker.com/build/customize/bake/file-definition/ ) |
| `workdir` | String | Working directory of execution |
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
| `no-cache` | Bool | Do not use cache when building the image (default `false` ) |
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false` ) |
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false` ) |
2023-04-18 11:56:30 +02:00
| `provenance` | Bool/String | [Provenance ](https://docs.docker.com/build/attestations/slsa-provenance/ ) is a shorthand for `--set=*.attest=type=provenance` |
2023-03-13 14:37:07 +01:00
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false` ) |
| `sbom` | Bool/String | [SBOM ](https://docs.docker.com/build/attestations/sbom/ ) is a shorthand for `--set=*.attest=type=sbom` |
| `set` | List | List of [targets values to override ](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set ) (eg: `targetpattern.key=value` ) |
| `source` | String | [Remote bake definition ](https://docs.docker.com/build/customize/bake/file-definition/#remote-definition ) to build from |
2020-12-23 23:44:52 +01:00
2021-09-01 22:22:37 +02:00
### outputs
Following outputs are available
2022-10-07 16:41:51 +02:00
| Name | Type | Description |
|------------|------|-----------------------|
| `metadata` | JSON | Build result metadata |
2021-09-01 22:22:37 +02:00
2022-10-07 16:41:51 +02:00
## Contributing
2020-10-08 00:52:52 +02:00
2022-10-07 16:41:51 +02:00
Want to contribute? Awesome! You can find information about contributing to
this project in the [CONTRIBUTING.md ](/.github/CONTRIBUTING.md )