From 15a9c2120335b1c80c64c0957dc85f7b40d6b0d1 Mon Sep 17 00:00:00 2001 From: Denys Vitali Date: Sat, 24 Jan 2026 20:23:55 +0100 Subject: [PATCH] Add Build & Release Docker Image workflows (#1602) * ci: build & release docker image * ci: sync docker-release workflow updates Squashes: - ci: use correct runs-on - ci: build images Co-Authored-By: Claude * Remove submodule checkout from docker-release.yml Removed submodule checkout step from Docker release workflow. * Simplify Docker release workflow by removing submodule checkout Removed submodule checkout step from Docker release workflow. --------- Co-authored-by: Claude --- .github/workflows/docker-release.yml | 143 +++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 .github/workflows/docker-release.yml diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 000000000..aa175961d --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,143 @@ +name: Docker Release + +on: + push: + branches: + - main + tags: + - "v*" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + # Build amd64 image + build-amd64: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + outputs: + image-digest: ${{ steps.build.outputs.digest }} + image-metadata: ${{ steps.meta.outputs.json }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{version}},suffix=-amd64 + type=semver,pattern={{version}},suffix=-arm64 + type=ref,event=branch,suffix=-amd64 + type=ref,event=branch,suffix=-arm64 + + - name: Build and push amd64 image + id: build + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + provenance: false + push: true + + # Build arm64 image + build-arm64: + runs-on: ubuntu-24.04-arm + permissions: + packages: write + contents: read + outputs: + image-digest: ${{ steps.build.outputs.digest }} + image-metadata: ${{ steps.meta.outputs.json }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{version}},suffix=-amd64 + type=semver,pattern={{version}},suffix=-arm64 + type=ref,event=branch,suffix=-amd64 + type=ref,event=branch,suffix=-arm64 + + - name: Build and push arm64 image + id: build + uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/arm64 + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + provenance: false + push: true + + # Create multi-platform manifest + create-manifest: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + needs: [build-amd64, build-arm64] + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for manifest + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + + - name: Create and push manifest + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + ${{ needs.build-amd64.outputs.image-digest }} \ + ${{ needs.build-arm64.outputs.image-digest }} + env: + DOCKER_METADATA_OUTPUT_JSON: ${{ steps.meta.outputs.json }}