name: ASF-docker-ci

on: [push, pull_request]

env:
  PLATFORMS: linux/amd64,linux/arm,linux/arm64

permissions: {}

jobs:
  main:
    strategy:
      fail-fast: false
      matrix:
        configuration: [Debug, Release]
        file: [Dockerfile, Dockerfile.Service]

    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      with:
        show-progress: false
        submodules: recursive

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

    - name: Build ${{ matrix.configuration }} Docker image from ${{ matrix.file }}
      uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
      with:
        build-args: CONFIGURATION=${{ matrix.configuration }}
        context: .
        file: ${{ matrix.file }}
        platforms: ${{ env.PLATFORMS }}
        provenance: true
        sbom: true
