Skip to content

Add arm and aarch64 supportsΒ #2

Open
@scc-tw

Description

@scc-tw

Issue Details

Our project's CI/CD pipeline currently builds and tests only on x86 architecture. As the usage of ARM and AArch64 architectures is increasing, especially in cloud environments and new generation personal devices, adding support for these architectures will make our application more versatile and accessible.

Suggested Changes

1. Update Dockerfile to Support Multi-Architecture Builds

  • Revise Dockerfiles: Modify Dockerfiles to support ARM and AArch64 by using multi-architecture base images.

2. Update GitHub Actions Workflow

  • Extend Strategy Matrix: Include ARM and AArch64 architectures in the GitHub Actions build matrix.
  • Utilize Multi-Arch Build Tools: Implement Docker Buildx or similar tools to build images for multiple architectures.

3. Test on ARM and AArch64 Architectures

  • Add Test Jobs: Ensure that there are specific test jobs for ARM and AArch64 to validate functionality on these architectures.

Executable Steps

Update Dockerfile

  1. Use Multi-Arch Base Images:
    Modify the Dockerfile to start with a base image that supports multiple architectures, like ubuntu:latest or debian:latest.

    FROM --platform=linux/amd64,linux/arm64,linux/arm/v7 ubuntu:latest
  2. Verify Dependencies:
    Check and test that all dependencies and tools used in the build are available and functional on ARM and AArch64.

Update GitHub Actions

  1. Modify Build Matrix:
    Update the .github/workflows/ci.yml file to include ARM (arm/v7) and AArch64 (arm64) architectures.

    jobs:
      build:
        runs-on: ubuntu-latest
        strategy:
          matrix:
            architecture: ['x86_64', 'arm/v7', 'arm64']
  2. Setup Docker Buildx:
    Implement Docker Buildx in the GitHub Actions workflow to build Docker images for all specified architectures.

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v2
    
    - name: Build docker image
      run: |
        docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
          --push -t my-image-name:${{ github.sha }} .
  3. Test Each Architecture:
    Ensure each architecture has corresponding test scripts or configurations to validate the builds.

    - name: Test on ARM
      if: matrix.architecture == 'arm/v7'
      run: ./test-arm.sh
    - name: Test on AArch64
      if: matrix.architecture == 'arm64'
      run: ./test-aarch64.sh

Expected Benefits

  • Wider Compatibility: Supports a broader range of platforms, increasing the project's accessibility.
  • Future-Proofing: Prepares the project for future trends where ARM and AArch64 are becoming more prevalent.
  • Improved Market Reach: Expands potential user base by accommodating devices that use ARM and AArch64 architectures.

Actions

  1. Review and Approve Changes: Discuss the proposed changes with the development team for alignment and approval.
  2. Implement and Test: Apply changes in a feature branch, conduct thorough testing on all architectures.
  3. Merge and Monitor: Merge the changes into the main branch upon successful testing and continue to monitor performance across architectures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions