Skip to content

Commit

Permalink
Update Docker Build and Push action for ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-levo committed Feb 20, 2024
1 parent 359a358 commit fce5688
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 183 deletions.
63 changes: 18 additions & 45 deletions .github/workflows/build-and-release-crapi-community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,27 @@ on:
workflow_dispatch:

jobs:
build-community-image:
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-20.04
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Build image
uses: aevea/action-kaniko@master
- uses: actions/checkout@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-community
path: ./crAPI/services/community
tag: latest
cache: true
# Don't push the image, just build it to validate it.
extra_args: "--no-push --cache-repo levoai/crapi-community-cache"

push-latest-community-image:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Latest image push
uses: aevea/action-kaniko@master
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-community
path: ./crAPI/services/community
tag: latest
cache: true
extra_args: "--cache-repo levoai/crapi-community-cache"

release-community-image:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Tagged image push
uses: aevea/action-kaniko@master
- name: Build and push
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-community
path: ./crAPI/services/community
strip_tag_prefix: v
cache: true
extra_args: "--cache-repo levoai/crapi-community-cache"
context: ./crAPI/services/community
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-community:latest
cache-from: type=registry,ref=levoai/crapi-community-cache
cache-to: type=registry,ref=levoai/crapi-community-cache,mode=max
63 changes: 18 additions & 45 deletions .github/workflows/build-and-release-crapi-identity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,27 @@ on:
workflow_dispatch:

jobs:
build-identity-image:
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-20.04
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Build image
uses: aevea/action-kaniko@master
- uses: actions/checkout@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-identity
path: ./crAPI/services/identity
tag: latest
cache: true
# Don't push the image, just build it to validate it.
extra_args: "--no-push --cache-repo levoai/crapi-identity-cache"

push-latest-identity-image:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Latest image push
uses: aevea/action-kaniko@master
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-identity
path: ./crAPI/services/identity
tag: latest
cache: true
extra_args: "--cache-repo levoai/crapi-identity-cache"

release-identity-image:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Tagged image push
uses: aevea/action-kaniko@master
- name: Build and push
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-identity
path: ./crAPI/services/identity
strip_tag_prefix: v
cache: true
extra_args: "--cache-repo levoai/crapi-identity-cache"
context: ./crAPI/services/identity
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-identity:latest
cache-from: type=registry,ref=levoai/crapi-identity-cache
cache-to: type=registry,ref=levoai/crapi-identity-cache,mode=max
67 changes: 19 additions & 48 deletions .github/workflows/build-and-release-crapi-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,28 @@ on:
workflow_dispatch:

jobs:
build-web-image:
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-20.04
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Build image
uses: aevea/action-kaniko@master
- uses: actions/checkout@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-web
path: ./crAPI/services/web
tag: latest
cache: true
# Don't push the image, just build it to validate it.
extra_args: "--no-push --cache-repo levoai/crapi-web-cache"

push-latest-web-image:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Latest image push
uses: aevea/action-kaniko@master
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-web
path: ./crAPI/services/web
tag: latest
cache: true
extra_args: "--cache-repo levoai/crapi-web-cache"

release-web-image:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17.1'

- name: Tagged image push
uses: aevea/action-kaniko@master
- name: Build and push
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-web
path: ./crAPI/services/web
strip_tag_prefix: v
cache: true
extra_args: "--cache-repo levoai/crapi-web-cache"
context: ./crAPI/services/web
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-web:latest
cache-from: type=registry,ref=levoai/crapi-web-cache
cache-to: type=registry,ref=levoai/crapi-web-cache,mode=max

64 changes: 19 additions & 45 deletions .github/workflows/build-and-release-crapi-workshop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,28 @@ on:
workflow_dispatch:

jobs:
build-workshop-image:
if: ${{ github.ref != 'refs/heads/main' }}
runs-on: ubuntu-20.04
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Build image
uses: aevea/action-kaniko@master
- uses: actions/checkout@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-workshop
path: ./crAPI/services/workshop
tag: latest
cache: true
# Don't push the image, just build it to validate it.
extra_args: "--no-push --cache-repo levoai/crapi-workshop-cache"

push-latest-workshop-image:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Latest image push
uses: aevea/action-kaniko@master
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-workshop
path: ./crAPI/services/workshop
tag: latest
cache: true
extra_args: "--cache-repo levoai/crapi-workshop-cache"

release-workshop-image:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Tagged image push
uses: aevea/action-kaniko@master
- name: Build and push
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: levoai/crapi-workshop
path: ./crAPI/services/workshop
strip_tag_prefix: v
cache: true
extra_args: "--cache-repo levoai/crapi-workshop-cache"
context: ./crAPI/services/workshop
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-workshop:latest
cache-from: type=registry,ref=levoai/crapi-workshop-cache
cache-to: type=registry,ref=levoai/crapi-workshop-cache,mode=max

0 comments on commit fce5688

Please sign in to comment.