mirror of
https://github.com/docker/build-push-action.git
synced 2024-12-25 00:02:13 -05:00
Merge pull request #362 from akhilerm/add-tag-push-action
Add tag-push action to advanced usage section
This commit is contained in:
commit
95f997534a
2 changed files with 75 additions and 0 deletions
|
@ -31,6 +31,7 @@ ___
|
|||
* [Secrets](docs/advanced/secrets.md)
|
||||
* [Isolated builders](docs/advanced/isolated-builders.md)
|
||||
* [Push to multi-registries](docs/advanced/push-multi-registries.md)
|
||||
* [Copy between registries](docs/advanced/copy-between-registries.md)
|
||||
* [Cache](docs/advanced/cache.md)
|
||||
* [Registry cache](docs/advanced/cache.md#registry-cache)
|
||||
* [GitHub cache](docs/advanced/cache.md#github-cache)
|
||||
|
@ -167,6 +168,7 @@ jobs:
|
|||
* [Secrets](docs/advanced/secrets.md)
|
||||
* [Isolated builders](docs/advanced/isolated-builders.md)
|
||||
* [Push to multi-registries](docs/advanced/push-multi-registries.md)
|
||||
* [Copy between registries](docs/advanced/copy-between-registries.md)
|
||||
* [Cache](docs/advanced/cache.md)
|
||||
* [Registry cache](docs/advanced/cache.md#registry-cache)
|
||||
* [GitHub cache](docs/advanced/cache.md#github-cache)
|
||||
|
|
73
docs/advanced/copy-between-registries.md
Normal file
73
docs/advanced/copy-between-registries.md
Normal file
|
@ -0,0 +1,73 @@
|
|||
# Copy images between registries
|
||||
|
||||
Multi-platform images built using buildx can be copied from one registry to another without
|
||||
changing the image SHA using the [tag-push-action](https://github.com/akhilerm/tag-push-action).
|
||||
|
||||
The following workflow will first push the image to dockerhub, run some tests using the images
|
||||
and then push to quay and ghcr
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- # quay and ghcr logins for pushing image after testing
|
||||
name: Login to Quay Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: quay.io
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
password: ${{ secrets.QUAY_TOKEN }}
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
-
|
||||
name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
user/app:latest
|
||||
user/app:1.0.0
|
||||
- # run tests using image from docker hub
|
||||
name: Run Tests
|
||||
run: make tests
|
||||
- # copy multiplatform image from dockerhub to quay and ghcr
|
||||
name: Push Image to multiple registries
|
||||
uses: akhilerm/tag-push-action@v1.0.0
|
||||
with:
|
||||
src: docker.io/user/app:1.0.0
|
||||
dst: |
|
||||
quay.io/user/app:latest
|
||||
quay.io/user/app:1.0.0
|
||||
ghcr.io/user/app:latest
|
||||
ghcr.io/user/app:1.0.0
|
||||
```
|
Loading…
Reference in a new issue