Skip to content

Migrate to Docker Buildx for multi-architecture builds - ARM64 support currently commented #47

@Kaushik-Vijayakumar

Description

@Kaushik-Vijayakumar

Problem Description

The repository claims to support multi-architecture Docker images, but currently only builds for AMD64 architecture. This makes the Docker images unusable on ARM-based systems (Apple Silicon Macs, ARM64 servers, etc.).

Current Issues:

  1. Only AMD64 builds enabled: In scripts/build/docker/build-publish-image-all.sh, line 17 shows that ARM64 and other architectures are commented out:

    #archs=("amd64" "arm64" "arm" "ppc64le" "s390x")
    archs=("amd64")  # Only building AMD64
  2. Outdated build approach: The current build process uses the older, complex approach of building separate images per architecture and manually creating Docker manifests, which is error-prone and harder to maintain.

  3. User experience: Users on ARM systems (M1/M2 Macs, ARM64 servers) cannot use the published Docker images, despite documentation suggesting multi-arch support.

Solution: Migrate to Docker Buildx

The build process should be migrated to Docker Buildx for true multi-architecture builds. This is the modern Docker standard used by most contemporary projects including Kubernetes, Prometheus, and other CNCF projects.

Benefits:
Simplify the build process - Single command instead of complex shell scripts
Enable true multi-arch - All architectures built and pushed together automatically
Improve maintainability - Less custom scripting, more standard Docker tooling
Better user experience - docker pull works seamlessly on any architecture
Future-proof - Buildx is the industry standard for multi-arch builds

Implementation

Replace the current build scripts with a buildx-based approach:

# Example buildx command
docker buildx build \
  --platform linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x \
  --push \
  -t ghcr.io/slok/kube-code-generator:${VERSION} \
  -f docker/prod/Dockerfile .

This would:

  • Eliminate the need for separate per-arch builds
  • Remove manual manifest creation/annotation steps
  • Simplify CI/CD workflows significantly
  • Provide better error handling and logging
  • Enable all the currently commented architectures

Impact

  • Users: Can use Docker images on any architecture without worrying about compatibility
  • Maintainers: Simpler, more reliable build process with less maintenance overhead
  • CI/CD: Faster builds and reduced complexity
  • Alignment: Implementation matches documentation claims of multi-arch support

Implementation Plan

I will implement this migration to enable all the currently commented architectures (amd64, arm64, arm, ppc64le, s390x) using Docker Buildx. The current Dockerfile already includes ARG ARCH for cross-compilation, so it's ready for this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions