Skip to content

Commit

Permalink
Merge pull request #51 from adrianchiris/fix-image-push-2
Browse files Browse the repository at this point in the history
fix image push workflows
  • Loading branch information
moshe010 authored May 30, 2023
2 parents f863a01 + b880ccd commit ffa376e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 64 deletions.
50 changes: 21 additions & 29 deletions .github/workflows/image-push-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,51 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ env.IMAGE_NAME }}:latest-amd64
${{ steps.docker_meta.outputs.tags }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:${{ github.sha }}
file: ./Dockerfile

build-and-push-arm64-rdma-cni:
name: image push arm64
runs-on: ubuntu-22.04
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -71,23 +71,23 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -101,26 +101,18 @@ jobs:
needs: [build-and-push-amd64-rdma-cni,build-and-push-arm64-rdma-cni,build-and-push-ppc64le-rdma-cni]
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest for multi-arch images
run: |
# pull
docker pull ${{ env.IMAGE_NAME }}:latest-amd64
docker pull ${{ env.IMAGE_NAME }}:latest-arm64
docker pull ${{ env.IMAGE_NAME }}:latest-ppc64le
# create
docker manifest create ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 ${{ env.IMAGE_NAME }}:latest-arm64 ${{ env.IMAGE_NAME }}:latest-ppc64le
# annotate
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-amd64 --arch amd64
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-arm64 --arch arm64
docker manifest annotate ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:latest-ppc64le --arch ppc64le
# push
docker manifest push ${{ env.IMAGE_NAME }}:latest
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest \
${{ env.IMAGE_NAME }}:latest-amd64 \
${{ env.IMAGE_NAME }}:latest-arm64 \
${{ env.IMAGE_NAME }}:latest-ppc64le
65 changes: 30 additions & 35 deletions .github/workflows/image-push-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,63 @@ jobs:
name: image push AMD64
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tag-latest: false
tags: |
type=ref,event=tag
- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64
tags: |
${{ steps.docker_meta.outputs.tags }}-amd64
${{ steps.docker_meta.outputs.tags }}:${{ github.sha }}
file: ./Dockerfile

build-and-push-arm64-rdma-cni:
runs-on: ubuntu-22.04
name: image push ARM64
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tag-latest: false
tags: |
type=ref,event=tag
- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -82,27 +83,28 @@ jobs:
name: image push ppc64le
steps:
- name: check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: login to Docker
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tag-latest: false
tags: |
type=ref,event=tag
- name: build and push rdma-cni
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -116,33 +118,26 @@ jobs:
needs: [build-and-push-amd64-rdma-cni,build-and-push-arm64-rdma-cni,build-and-push-ppc64le-rdma-cni]
steps:
- name: set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ${{ env.IMAGE_NAME }}
tag-latest: false
tags: |
type=ref,event=tag
- name: login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: create manifest for multi-arch images
run: |
# pull
docker pull ${{ steps.docker_meta.outputs.tags }}-amd64
docker pull ${{ steps.docker_meta.outputs.tags }}-arm64
docker pull ${{ steps.docker_meta.outputs.tags }}-ppc64le
# create
docker manifest create ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 ${{ steps.docker_meta.outputs.tags }}-arm64 ${{ steps.docker_meta.outputs.tags }}-ppc64le
# annotate
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 --arch amd64
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-arm64 --arch arm64
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-ppc64le --arch ppc64le
# push
docker manifest push ${{ steps.docker_meta.outputs.tags }}
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.tags }} \
${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.tags }}-amd64 \
${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.tags }}-arm64 \
${{ env.IMAGE_NAME }}:${{ steps.docker_meta.outputs.tags }}-ppc64le

0 comments on commit ffa376e

Please sign in to comment.