From b89824f84a278ba874e9914cd2574ebdb4119131 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 23 Feb 2023 01:33:23 +0100 Subject: [PATCH] build(gha): move copy between registries section to dedicated page Signed-off-by: CrazyMax --- _data/toc.yaml | 2 + .../github-actions/copy-image-registries.md | 62 +++++++++++++++++++ build/ci/github-actions/examples.md | 62 ------------------- 3 files changed, 64 insertions(+), 62 deletions(-) create mode 100644 build/ci/github-actions/copy-image-registries.md diff --git a/_data/toc.yaml b/_data/toc.yaml index fb33bbb584..07ec550170 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -1629,6 +1629,8 @@ manuals: title: Share built image between jobs - path: /build/ci/github-actions/named-contexts/ title: Named contexts + - path: /build/ci/github-actions/copy-image-registries/ + title: Copy image between registries - path: /build/ci/github-actions/examples/ title: Examples - sectiontitle: Bake diff --git a/build/ci/github-actions/copy-image-registries.md b/build/ci/github-actions/copy-image-registries.md new file mode 100644 index 0000000000..723a5c45a7 --- /dev/null +++ b/build/ci/github-actions/copy-image-registries.md @@ -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 %} diff --git a/build/ci/github-actions/examples.md b/build/ci/github-actions/examples.md index 75adeb400c..d49700ae59 100644 --- a/build/ci/github-actions/examples.md +++ b/build/ci/github-actions/examples.md @@ -7,68 +7,6 @@ keywords: ci, github actions, gha, examples This page showcases different examples of how you can customize and use the 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 You can update the Docker Hub repository description using a third party action