Merge pull request #313 from voidxno/docs_calctool #1688
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: Docker | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '**' | |
| # Automatically cancel previous runs for the same ref (i.e. branch) and event type. The latter component prevents | |
| # manually dispatched events from being cancelled by pushes to the `master` branch. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push-image: | |
| name: Build and push image | |
| runs-on: ubuntu-latest | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - final-build-stage: 'base' | |
| latest-tag-behaviour: auto | |
| version-suffix: '' | |
| suffix-onlatest: false | |
| - final-build-stage: amd | |
| latest-tag-behaviour: auto | |
| version-suffix: '-amd' | |
| suffix-onlatest: true | |
| - final-build-stage: nvidia | |
| latest-tag-behaviour: auto | |
| version-suffix: '-nvidia' | |
| suffix-onlatest: true | |
| - final-build-stage: intel | |
| latest-tag-behaviour: auto | |
| version-suffix: '-intel' | |
| suffix-onlatest: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| submodules: "recursive" | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| flavor: | | |
| latest=${{ matrix.latest-tag-behaviour }} | |
| suffix=${{ matrix.version-suffix }},onlatest=${{ matrix.suffix-onlatest }} | |
| tags: | | |
| type=edge | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to the container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| target: ${{ matrix.final-build-stage }} | |
| push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |