1
1
# Copy images between registries
2
2
3
- Multi-platform images built using buildx can be copied from one registry to another without
4
- changing the image SHA using the [ tag-push-action] ( https://github.com/akhilerm/tag-push-action ) .
5
-
6
- The following workflow will first push the image to dockerhub, run some tests using the images
7
- and then push to quay and ghcr
3
+ [ Multi-platform images] ( https://docs.docker.com/build/building/multi-platform/ )
4
+ built using Buildx can be copied from one registry to another using the
5
+ [ ` imagetools create ` command] ( https://docs.docker.com/engine/reference/commandline/buildx_imagetools_create/ ) :
8
6
9
7
``` yaml
10
8
name : ci
@@ -27,26 +25,19 @@ jobs:
27
25
-
28
26
name : Set up Docker Buildx
29
27
uses : docker/setup-buildx-action@v2
30
- - # quay and ghcr logins for pushing image after testing
31
- name : Login to Quay Registry
28
+ -
29
+ name : Login to Docker Hub
32
30
uses : docker/login-action@v2
33
31
with :
34
- registry : quay.io
35
- username : ${{ secrets.QUAY_USERNAME }}
36
- password : ${{ secrets.QUAY_TOKEN }}
32
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
33
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
37
34
-
38
35
name : Login to GitHub Container Registry
39
36
uses : docker/login-action@v2
40
37
with :
41
38
registry : ghcr.io
42
39
username : ${{ github.repository_owner }}
43
40
password : ${{ secrets.GITHUB_TOKEN }}
44
- -
45
- name : Login to DockerHub
46
- uses : docker/login-action@v2
47
- with :
48
- username : ${{ secrets.DOCKERHUB_USERNAME }}
49
- password : ${{ secrets.DOCKERHUB_TOKEN }}
50
41
-
51
42
name : Build and push
52
43
uses : docker/build-push-action@v3
@@ -57,17 +48,11 @@ jobs:
57
48
tags : |
58
49
user/app:latest
59
50
user/app:1.0.0
60
- - # run tests using image from docker hub
61
- name : Run Tests
62
- run : make tests
63
- - # copy multiplatform image from dockerhub to quay and ghcr
64
- name : Push Image to multiple registries
65
-
66
- with :
67
- src : docker.io/user/app:1.0.0
68
- dst : |
69
- quay.io/user/app:latest
70
- quay.io/user/app:1.0.0
71
- ghcr.io/user/app:latest
72
- ghcr.io/user/app:1.0.0
51
+ -
52
+ name : Push image to GHCR
53
+ run : |
54
+ docker buildx imagetools create \
55
+ --tag ghcr.io/user/app:latest \
56
+ --tag ghcr.io/user/app:1.0.0 \
57
+ user/app:latest
73
58
` ` `
0 commit comments