mirror of https://github.com/docker/docs.git
build(gha): move copy between registries section to dedicated page
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
e7752b350c
commit
b89824f84a
|
@ -1629,6 +1629,8 @@ manuals:
|
||||||
title: Share built image between jobs
|
title: Share built image between jobs
|
||||||
- path: /build/ci/github-actions/named-contexts/
|
- path: /build/ci/github-actions/named-contexts/
|
||||||
title: Named contexts
|
title: Named contexts
|
||||||
|
- path: /build/ci/github-actions/copy-image-registries/
|
||||||
|
title: Copy image between registries
|
||||||
- path: /build/ci/github-actions/examples/
|
- path: /build/ci/github-actions/examples/
|
||||||
title: Examples
|
title: Examples
|
||||||
- sectiontitle: Bake
|
- sectiontitle: Bake
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
---
|
||||||
|
title: Copy image between registries with GitHub Actions
|
||||||
|
keywords: ci, github actions, gha, buildkit, buildx, registry
|
||||||
|
---
|
||||||
|
|
||||||
|
[Multi-platform images](../../building/multi-platform.md) built using Buildx can
|
||||||
|
be copied from one registry to another using the [`buildx imagetools create` command](../../../engine/reference/commandline/buildx_imagetools_create.md):
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
user/app:latest
|
||||||
|
user/app:1.0.0
|
||||||
|
-
|
||||||
|
name: Push image to GHCR
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create \
|
||||||
|
--tag ghcr.io/user/app:latest \
|
||||||
|
--tag ghcr.io/user/app:1.0.0 \
|
||||||
|
user/app:latest
|
||||||
|
```
|
||||||
|
{% endraw %}
|
|
@ -7,68 +7,6 @@ keywords: ci, github actions, gha, examples
|
||||||
This page showcases different examples of how you can customize and use the
|
This page showcases different examples of how you can customize and use the
|
||||||
Docker GitHub Actions in your CI pipelines.
|
Docker GitHub Actions in your CI pipelines.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Copy images between registries
|
|
||||||
|
|
||||||
[Multi-platform images](../../building/multi-platform.md) built using Buildx can
|
|
||||||
be copied from one registry to another using the [`buildx imagetools create` command](../../../engine/reference/commandline/buildx_imagetools_create.md):
|
|
||||||
|
|
||||||
{% raw %}
|
|
||||||
```yaml
|
|
||||||
name: ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
-
|
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
-
|
|
||||||
name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
user/app:latest
|
|
||||||
user/app:1.0.0
|
|
||||||
-
|
|
||||||
name: Push image to GHCR
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools create \
|
|
||||||
--tag ghcr.io/user/app:latest \
|
|
||||||
--tag ghcr.io/user/app:1.0.0 \
|
|
||||||
user/app:latest
|
|
||||||
```
|
|
||||||
{% endraw %}
|
|
||||||
|
|
||||||
## Update Docker Hub repository description
|
## Update Docker Hub repository description
|
||||||
|
|
||||||
You can update the Docker Hub repository description using a third party action
|
You can update the Docker Hub repository description using a third party action
|
||||||
|
|
Loading…
Reference in New Issue