Update build-and-publish.yml#2
Conversation
Signed-off-by: AsamaSumer <sumer@asama.ai>
WalkthroughThe GitHub Actions workflow for building and publishing Docker images has been updated to explicitly support multi-architecture builds. Separate build-and-push steps are now included for AMD64 and ARM64 images, with architecture-specific tags. A new step creates and pushes Docker manifest lists aggregating these images under unified tags. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant QEMU
participant Docker Buildx
participant Docker Registry
GitHub Actions->>QEMU: Set up QEMU for multi-arch builds
GitHub Actions->>Docker Buildx: Set up Buildx builder
GitHub Actions->>Docker Buildx: Build & push AMD64 image (tag: -amd64)
Docker Buildx->>Docker Registry: Push amd64 image
GitHub Actions->>Docker Buildx: Build & push ARM64 image (tag: -arm64)
Docker Buildx->>Docker Registry: Push arm64 image
GitHub Actions->>Docker Registry: Create & push multi-arch manifest (unified tags)
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
.github/workflows/build-and-publish.yml (4)
2-2: Remove trailing whitespace
Several lines contain trailing spaces and are causing YAML lint errors. Please strip all trailing spaces to satisfyyamllintand keep the file clean.Also applies to: 7-7, 15-15, 32-32, 43-43, 55-55, 83-83, 94-94, 105-105, 112-112, 117-117, 120-120, 126-126
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 2-2: trailing spaces
(trailing-spaces)
84-94: Refactor AMD64 build tags for clarity
The inline comma-delimitedtagsexpression works, but a YAML list is more readable and maintainable. For example:-with: - context: . - platforms: linux/amd64 - push: true - tags: ${{ steps.get_info.outputs.set_latest == 'true' && format('ghcr.io/{0}:{1}-amd64,ghcr.io/{0}:latest-amd64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) || format('ghcr.io/{0}:{1}-amd64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) }} - cache-from: type=gha,scope=amd64 - cache-to: type=gha,mode=max,scope=amd64 +with: + context: . + platforms: linux/amd64 + push: true + tags: + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }}-amd64 + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latest-amd64 + cache-from: type=gha,scope=amd64 + cache-to: type=gha,mode=max,scope=amd64🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 94-94: trailing spaces
(trailing-spaces)
95-105: Refactor ARM64 build tags for clarity
Mirror the AMD64 step by using a YAML list fortags, reducing expression complexity:-with: - context: . - platforms: linux/arm64 - push: true - tags: ${{ steps.get_info.outputs.set_latest == 'true' && format('ghcr.io/{0}:{1}-arm64,ghcr.io/{0}:latest-arm64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) || format('ghcr.io/{0}:{1}-arm64', steps.get_info.outputs.repo_name, steps.get_info.outputs.version) }} - cache-from: type=gha,scope=arm64 - cache-to: type=gha,mode=max,scope=arm64 +with: + context: . + platforms: linux/arm64 + push: true + tags: + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }}-arm64 + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latest-arm64 + cache-from: type=gha,scope=arm64 + cache-to: type=gha,mode=max,scope=arm64🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 105-105: trailing spaces
(trailing-spaces)
106-129: Simplify multi-arch workflow with a single Buildx step
Rather than separate AMD64/ARM64 builds and manualdocker manifestcommands, leverage Buildx’s built-in multi-platform support:-# Build and push AMD64 image -# Build and push ARM64 image -# Create and push multi-arch manifest + - name: Build and push multi-arch image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:${{ steps.get_info.outputs.version }} + - ghcr.io/${{ steps.get_info.outputs.repo_name }}:latestThis single step automatically builds both architectures and pushes a combined manifest, making the workflow more concise.
🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 112-112: trailing spaces
(trailing-spaces)
[error] 117-117: trailing spaces
(trailing-spaces)
[error] 120-120: trailing spaces
(trailing-spaces)
[error] 126-126: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/build-and-publish.yml(5 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/build-and-publish.yml
[error] 2-2: trailing spaces
(trailing-spaces)
[error] 7-7: trailing spaces
(trailing-spaces)
[error] 11-11: trailing spaces
(trailing-spaces)
[error] 15-15: trailing spaces
(trailing-spaces)
[error] 32-32: trailing spaces
(trailing-spaces)
[error] 43-43: trailing spaces
(trailing-spaces)
[error] 55-55: trailing spaces
(trailing-spaces)
[error] 83-83: trailing spaces
(trailing-spaces)
[error] 94-94: trailing spaces
(trailing-spaces)
[error] 105-105: trailing spaces
(trailing-spaces)
[error] 112-112: trailing spaces
(trailing-spaces)
[error] 117-117: trailing spaces
(trailing-spaces)
[error] 120-120: trailing spaces
(trailing-spaces)
[error] 126-126: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Artifacts / Container images (distroless)
- GitHub Check: Artifacts / Container images (alpine)
- GitHub Check: Test
🔇 Additional comments (1)
.github/workflows/build-and-publish.yml (1)
53-55: Enable QEMU before Buildx
Addingdocker/setup-qemu-action@v3ensures proper emulation for multi-architecture builds. Placement beforedocker/setup-buildx-action@v3is correct.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 55-55: trailing spaces
(trailing-spaces)
Overview
What this PR does / why we need it
Special notes for your reviewer
Summary by CodeRabbit