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)
2021-01-28 23:14:03 +01:00
[](https://github.com/docker/bake-action/actions?workflow=test)
[](https://codecov.io/gh/docker/bake-action)
## :test_tube: Experimental
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
2021-04-03 20:37:29 +02:00
GitHub Action to use Docker [Buildx Bake ](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md )
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 )
2020-10-08 00:52:52 +02:00
* [Keep up-to-date with GitHub Dependabot ](#keep-up-to-date-with-github-dependabot )
## 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
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
2021-01-28 23:14:03 +01:00
uses: docker/bake-action@master
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
> ```
| Name | Type | Description |
|------------------|----------|------------------------------------|
| `builder` | String | Builder instance (see [setup-buildx ](https://github.com/docker/setup-buildx-action ) action) |
2021-04-03 20:37:29 +02:00
| `files` | List/CSV | List of [bake definition files ](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#file ) |
2020-12-23 23:44:52 +01:00
| `targets` | List/CSV | List of bake targets |
| `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` ) |
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false` ) |
2021-04-03 20:37:29 +02:00
| `set` | List | List of [targets values to override ](https://github.com/docker/buildx/blob/master/docs/reference/buildx_bake.md#set ) (eg: `targetpattern.key=value` ) |
2020-12-23 23:44:52 +01:00
2021-09-01 22:22:37 +02:00
### outputs
Following outputs are available
| Name | Type | Description |
|-------------------|---------|---------------------------------------|
| `metadata` | JSON | Build result metadata |
2020-10-08 00:52:52 +02:00
## Keep up-to-date with GitHub Dependabot
Since [Dependabot ](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot )
has [native GitHub Actions support ](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem ),
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
```yaml
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
```