Files
bake-action/README.md

115 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

2021-01-28 23:14:03 +01:00
[![GitHub release](https://img.shields.io/github/release/docker/bake-action.svg?style=flat-square)](https://github.com/docker/bake-action/releases/latest)
2020-10-08 00:52:52 +02:00
[![GitHub marketplace](https://img.shields.io/badge/marketplace-docker--buildx--bake-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/docker-buildx-bake)
2021-01-28 23:14:03 +01:00
[![Test workflow](https://img.shields.io/github/workflow/status/docker/bake-action/test?label=test&logo=github&style=flat-square)](https://github.com/docker/bake-action/actions?workflow=test)
[![Codecov](https://img.shields.io/codecov/c/github/docker/bake-action?logo=codecov&style=flat-square)](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
![Screenshot](.github/bake-action.png)
2020-10-08 00:52:52 +02:00
___
* [Usage](#usage)
* [Customizing](#customizing)
* [inputs](#inputs)
* [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
> `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
> ```
> `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) |
| `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`) |
### 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"
```