Merge pull request #1000 from Smartappli/dependabot/github_actions/gi… #553
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AIMER Docker Builder | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| concurrency: | |
| group: aimer-docker-builder-${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || github.workflow_ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-docker-aimer: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - service: aimer-web | |
| dockerfile: ./services/aimer-web/Dockerfile | |
| tags: smartappli/aimer:latest | |
| - service: aimer-rag | |
| dockerfile: ./services/aimer-web/Dockerfile.rag | |
| tags: smartappli/aimer-rag:latest | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: false | |
| swap-storage: true | |
| - name: Checkout code | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c | |
| - name: Login to Docker Hub | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GHCR | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push (${{ matrix.service }}) | |
| id: build | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a | |
| with: | |
| context: ./services/aimer-web | |
| file: ${{ matrix.dockerfile }} | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| provenance: true | |
| sbom: true | |
| tags: ${{ matrix.tags }} | |
| - name: Install Cosign | |
| uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 | |
| - name: Sign published image (${{ matrix.service }}) | |
| env: | |
| DIGEST: ${{ steps.build.outputs.digest }} | |
| IMAGE_REF: ${{ matrix.tags }} | |
| run: cosign sign --yes "${IMAGE_REF}@${DIGEST}" | |
| - name: Write image digest evidence | |
| env: | |
| DIGEST: ${{ steps.build.outputs.digest }} | |
| IMAGE_REF: ${{ matrix.tags }} | |
| run: | | |
| mkdir -p image-digests | |
| printf '%s@%s\n' "${IMAGE_REF}" "${DIGEST}" > "image-digests/${{ matrix.service }}.txt" | |
| - name: Upload image digest evidence | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: image-digest-${{ matrix.service }} | |
| path: image-digests/${{ matrix.service }}.txt | |
| if-no-files-found: error |