mirror of
https://github.com/docker/build-push-action.git
synced 2024-11-15 17:43:52 +08:00
docs: copy between registries with buildx
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
48888e0b13
commit
105bf59b00
@ -1,10 +1,8 @@
|
|||||||
# Copy images between registries
|
# Copy images between registries
|
||||||
|
|
||||||
Multi-platform images built using buildx can be copied from one registry to another without
|
[Multi-platform images](https://docs.docker.com/build/building/multi-platform/)
|
||||||
changing the image SHA using the [tag-push-action](https://github.com/akhilerm/tag-push-action).
|
built using Buildx can be copied from one registry to another using the
|
||||||
|
[`imagetools create` command](https://docs.docker.com/engine/reference/commandline/buildx_imagetools_create/):
|
||||||
The following workflow will first push the image to dockerhub, run some tests using the images
|
|
||||||
and then push to quay and ghcr
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
@ -27,13 +25,12 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
- # quay and ghcr logins for pushing image after testing
|
-
|
||||||
name: Login to Quay Registry
|
name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: quay.io
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
username: ${{ secrets.QUAY_USERNAME }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
password: ${{ secrets.QUAY_TOKEN }}
|
|
||||||
-
|
-
|
||||||
name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@ -41,12 +38,6 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
|
||||||
name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
@ -57,17 +48,11 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
user/app:latest
|
user/app:latest
|
||||||
user/app:1.0.0
|
user/app:1.0.0
|
||||||
- # run tests using image from docker hub
|
-
|
||||||
name: Run Tests
|
name: Push image to GHCR
|
||||||
run: make tests
|
run: |
|
||||||
- # copy multiplatform image from dockerhub to quay and ghcr
|
docker buildx imagetools create \
|
||||||
name: Push Image to multiple registries
|
--tag ghcr.io/user/app:latest \
|
||||||
uses: akhilerm/tag-push-action@v2.0.0
|
--tag ghcr.io/user/app:1.0.0 \
|
||||||
with:
|
user/app:latest
|
||||||
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 New Issue
Block a user