@ -45,10 +45,7 @@ build-secrets, remote cache, etc. and different builder deployment/namespacing o
The default behavior of this action is to use the [Git context invoked by your workflow](https://github.com/docker/build-push-action/blob/master/src/context.ts#L35).
If you use this action in a private repository, you have to pass the [GitHub Token](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)
as a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with buildx:
Building from current repository automatically uses the [GitHub Token](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)
as provided by `secrets` so it does not need to be passed. But if you want to authenticate against another private
repository, you have to use a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with buildx:
```yaml
-
@ -96,7 +93,7 @@ as a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with bu
push: true
tags: user/app:latest
secrets: |
GIT_AUTH_TOKEN=${{ github.token }}
GIT_AUTH_TOKEN=${{ secrets.MYTOKEN }}
```
> :warning: Subdir for Git context is [not yet supported](https://github.com/docker/build-push-action/issues/120).
@ -106,17 +103,14 @@ as a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with bu
You can also use the `PATH` context alongside the [`actions/checkout`](https://github.com/actions/checkout/) action.
<details>
<summary><b>Show workflow</b></summary>
```yaml
name: ci
```yaml
name: ci
on:
on:
push:
branches: master
jobs:
jobs:
path-context:
runs-on: ubuntu-latest
steps:
@ -144,22 +138,18 @@ You can also use the `PATH` context alongside the [`actions/checkout`](https://g
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: user/app:latest
```
</details>
```
### Isolated builders
<details>
<summary><b>Show workflow</b></summary>
```yaml
name: ci
```yaml
name: ci
on:
on:
push:
branches: master
jobs:
jobs:
multi-builders:
runs-on: ubuntu-latest
steps:
@ -187,22 +177,18 @@ You can also use the `PATH` context alongside the [`actions/checkout`](https://g
with:
builder: ${{ steps.builder2.outputs.name }}
target: mytarget2
```
</details>
```
### Multi-platform image
<details>
<summary><b>Show workflow</b></summary>
```yaml
name: ci
```yaml
name: ci
on:
on:
push:
branches: master
jobs:
jobs:
multi:
runs-on: ubuntu-latest
steps:
@ -232,14 +218,13 @@ You can also use the `PATH` context alongside the [`actions/checkout`](https://g
tags: |
user/app:latest
user/app:1.0.0
```
</details>
```
## Advanced usage
### Local registry
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into.
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into:
<details>
<summary><b>Show workflow</b></summary>
@ -284,7 +269,7 @@ For testing purposes you may need to create a [local registry](https://hub.docke
### Leverage GitHub cache
You can leverage [GitHub cache](https://docs.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)
using [actions/cache](https://github.com/actions/cache) with this action.
using [actions/cache](https://github.com/actions/cache) with this action:
<details>
<summary><b>Show workflow</b></summary>
@ -338,15 +323,6 @@ The following workflow with the `Prepare` step will generate some [outputs](http
to handle tags and labels based on GitHub actions events. This is just an example to show many cases that you