| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- name: Docker
- on:
- push:
- paths-ignore:
- - "README.md"
- branches:
- - master
- env:
- IMAGE: zedeus/nitter
- jobs:
- tests:
- uses: ./.github/workflows/run-tests.yml
- secrets: inherit
- # Build each architecture natively (no emulation) and push by digest only.
- # The digests are stitched into a single multi-arch tag by the merge job.
- build:
- needs: [tests]
- strategy:
- fail-fast: false
- matrix:
- include:
- - runner: ubuntu-24.04
- platform: linux/amd64
- - runner: ubuntu-24.04-arm
- platform: linux/arm64
- runs-on: ${{ matrix.runner }}
- steps:
- - name: Prepare platform name
- run: echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
- env:
- platform: ${{ matrix.platform }}
- - uses: actions/checkout@v6
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- with:
- version: latest
- - name: Login to DockerHub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Build and push by digest
- id: build
- uses: docker/build-push-action@v6
- with:
- context: .
- file: ./Dockerfile
- platforms: ${{ matrix.platform }}
- outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
- # Attestations turn a single-platform push into a manifest index, which
- # breaks push-by-digest + the imagetools merge below. Disable them.
- provenance: false
- sbom: false
- - name: Export digest
- run: |
- mkdir -p "${{ runner.temp }}/digests"
- digest="${{ steps.build.outputs.digest }}"
- touch "${{ runner.temp }}/digests/${digest#sha256:}"
- - name: Upload digest
- uses: actions/upload-artifact@v4
- with:
- name: digests-${{ env.PLATFORM_PAIR }}
- path: ${{ runner.temp }}/digests/*
- if-no-files-found: error
- retention-days: 1
- # Combine the per-arch digests into one multi-arch manifest so that
- # `docker pull zedeus/nitter:latest` serves the right image on any CPU.
- merge:
- needs: [build]
- runs-on: ubuntu-24.04
- steps:
- - name: Download digests
- uses: actions/download-artifact@v4
- with:
- path: ${{ runner.temp }}/digests
- pattern: digests-*
- merge-multiple: true
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v3
- with:
- version: latest
- - name: Login to DockerHub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- - name: Create manifest list and push
- working-directory: ${{ runner.temp }}/digests
- run: |
- # latest-arm64 is a backward-compat alias of the (now multi-arch)
- # latest tag, for users still pinned to the old ARM64-only image.
- # word splitting is intentional: one image ref arg per digest file
- # shellcheck disable=SC2046
- docker buildx imagetools create \
- -t ${{ env.IMAGE }}:latest \
- -t ${{ env.IMAGE }}:latest-arm64 \
- -t ${{ env.IMAGE }}:${{ github.sha }} \
- $(printf '${{ env.IMAGE }}@sha256:%s ' *)
- - name: Inspect image
- run: docker buildx imagetools inspect ${{ env.IMAGE }}:${{ github.sha }}
|