Skip to content

Commit

Permalink
Update GitHub Action Workflow to Build Multi-Architecture Docker Imag…
Browse files Browse the repository at this point in the history
…es (#136)
  • Loading branch information
singatias authored Oct 14, 2024
1 parent 06b5381 commit b42a204
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 8 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/apps-event-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64, linux/arm64]

steps:
- uses: actions/checkout@v4

Expand All @@ -35,8 +41,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -55,12 +70,14 @@ jobs:
with:
push: false
file: apps/event-worker/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: apps/event-worker/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
19 changes: 18 additions & 1 deletion .github/workflows/apps-job-policy-checker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64, linux/arm64]

steps:
- uses: actions/checkout@v4

Expand All @@ -33,8 +39,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -53,12 +68,14 @@ jobs:
with:
push: false
file: apps/job-policy-checker/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: apps/job-policy-checker/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
19 changes: 18 additions & 1 deletion .github/workflows/apps-webservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64, linux/arm64]

steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +37,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -51,12 +66,14 @@ jobs:
with:
push: false
file: apps/webservice/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: apps/webservice/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
21 changes: 19 additions & 2 deletions .github/workflows/integrations-google-compute-scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64, linux/arm64]

steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +37,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -51,12 +66,14 @@ jobs:
with:
push: false
file: integrations/google-compute-scanner/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: integrations/google-compute-scanner/Dockerfile
file: integrations/google-compute-scanner/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
19 changes: 18 additions & 1 deletion .github/workflows/integrations-kubernetes-job-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ on:
jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
platform: [linux/amd64, linux/arm64]

steps:
- uses: actions/checkout@v4

Expand All @@ -31,8 +37,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -51,12 +66,14 @@ jobs:
with:
push: false
file: integrations/kubernetes-job-agent/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: integrations/kubernetes-job-agent/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
13 changes: 12 additions & 1 deletion .github/workflows/integrations-terraform-cloud-scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -51,12 +60,14 @@ jobs:
with:
push: false
file: integrations/terraform-cloud-scanner/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: integrations/terraform-cloud-scanner/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
13 changes: 12 additions & 1 deletion .github/workflows/packages-migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Check if Docker Hub secrets are available
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "DOCKERHUB_LOGIN=false" >> $GITHUB_ENV
else
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
if: env.DOCKERHUB_LOGIN == 'true'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -47,12 +56,14 @@ jobs:
with:
push: false
file: packages/db/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

- name: Build and Push
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' && env.DOCKERHUB_LOGIN == 'true'
with:
push: true
file: packages/db/Dockerfile
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit b42a204

Please sign in to comment.