Skip to content

Commit

Permalink
Update Docker build for multi-arch support
Browse files Browse the repository at this point in the history
- Add support for multiple architectures (linux/amd64, linux/arm64, linux/arm/v7)
- Enable Docker Buildx for cross-platform builds
- Update GitHub Actions workflow to support matrix builds
- Add Docker Scout for image size and recommendations
  • Loading branch information
jag-k committed Apr 13, 2024
1 parent 850c762 commit d98bd2e
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions .github/workflows/pr_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,16 @@ jobs:
contents: read
pull-requests: write
packages: read

strategy:
matrix:
platform: [linux/amd64, linux/arm64, linux/arm/v7]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
Expand All @@ -155,11 +144,11 @@ jobs:
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
key: ${{ runner.os }}-buildx-${{ matrix.platform }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
${{ runner.os }}-buildx-${{ matrix.platform }}-
- name: Build Docker image
- name: Build Docker image for ${{ matrix.platform }}
uses: docker/build-push-action@v5
id: build-and-push
with:
Expand All @@ -169,16 +158,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
platforms: linux/amd64,linux/arm64,linux/arm/v7

- name: Docker Scout
uses: docker/scout-action@v1
with:
command: quickview,recommendations,compare,environment
image: ${{ steps.meta.outputs.tags }}
to-latest: true
github-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
registry-user: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
platforms: ${{ matrix.platform }}

0 comments on commit d98bd2e

Please sign in to comment.