Skip to content

Commit

Permalink
Merge pull request #476 from crazy-max/metadata-example
Browse files Browse the repository at this point in the history
docs: example to sanitize tags with metadata-action
  • Loading branch information
crazy-max committed Oct 2, 2021
2 parents 96daefd + 0732bea commit 2cf7b61
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions TROUBLESHOOTING.md
Expand Up @@ -100,15 +100,33 @@ or a cache reference:
```

To fix this issue you can use our [metadata action](https://github.com/docker/metadata-action)
to generate sanitized tags, or a dedicated step to sanitize the slug:
to generate sanitized tags:

```yaml
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
tags: latest

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
```

Or a dedicated step to sanitize the slug:

```yaml
- name: Sanitize repo slug
uses: actions/github-script@v4
id: repo_slug
with:
result-encoding: string
script: return '${{ github.repository }}'.toLowerCase()
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()

- name: Build and push
uses: docker/build-push-action@v2
Expand Down

0 comments on commit 2cf7b61

Please sign in to comment.