Create Docker Image #29
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: Create Docker Image | |
| on: | |
| release: | |
| types: | |
| - created | |
| workflow_dispatch: | |
| env: | |
| DOCKER_REPO: ghcr.io/mutablelogic/gomedia | |
| jobs: | |
| build: | |
| name: Build | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64] | |
| runs-on: | |
| - ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || matrix.arch == 'arm64' && 'ubuntu-24.04-arm' }} | |
| env: | |
| OS: linux | |
| ARCH: ${{ matrix.arch }} | |
| outputs: | |
| tag: ${{ steps.build.outputs.tag }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Install build tools | |
| run: | | |
| sudo apt -y update | |
| sudo apt -y install build-essential git | |
| git config --global advice.detachedHead false | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push | |
| id: build | |
| run: | | |
| BUILDKIT_PROGRESS=plain make docker && make docker-push && make docker-version >> "$GITHUB_OUTPUT" | |
| manifest: | |
| name: Manifest | |
| needs: build | |
| strategy: | |
| matrix: | |
| tag: | |
| - ${{ needs.build.outputs.tag }} | |
| - "latest" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create | |
| run: | | |
| docker manifest create ${{ env.DOCKER_REPO }}:${{ matrix.tag }} \ | |
| --amend ${{ env.DOCKER_REPO }}:${{ needs.build.outputs.tag }}-linux-amd64 \ | |
| --amend ${{ env.DOCKER_REPO }}:${{ needs.build.outputs.tag }}-linux-arm64 | |
| - name: Annotate | |
| run: | | |
| docker manifest annotate --arch amd64 --os linux \ | |
| ${{ env.DOCKER_REPO }}:${{ matrix.tag }} \ | |
| ${{ env.DOCKER_REPO }}:${{ needs.build.outputs.tag }}-linux-amd64 | |
| docker manifest annotate --arch arm64 --os linux \ | |
| ${{ env.DOCKER_REPO }}:${{ matrix.tag }} \ | |
| ${{ env.DOCKER_REPO }}:${{ needs.build.outputs.tag }}-linux-arm64 | |
| - name: Push | |
| run: | | |
| docker manifest push ${{ env.DOCKER_REPO }}:${{ matrix.tag }} |