This project now supports building multi-architecture Docker images for both linux/amd64 and linux/arm64 platforms.
- Docker version >= 19.03
- Docker Buildx (usually included in newer Docker versions)
Before first use, you need to set up the buildx builder:
make docker-setup-buildxOr execute manually:
docker buildx create --name multiarch --driver docker-container --bootstrap --usemake docker-multiarchThis will build images for both linux/amd64 and linux/arm64 architectures, but will only save them in the local build cache.
If you only need to build an image for the current platform:
make docker- Multi-platform Base Images: Uses
--platform=$BUILDPLATFORMto ensure base images support multi-architecture - Cross-compilation Support:
- Added
gcc-aarch64-linux-gnucross-compiler for ARM64 - Configured corresponding Rust targets and linkers
- Added
- Conditional Building: Selects the correct compilation target based on
$TARGETPLATFORMenvironment variable - Smart Binary Copying: Copies the correct binary file based on the target platform
linux/amd64(x86_64)linux/arm64(aarch64)
- Uses
cargo-chefto cache dependency builds - Leverages Docker multi-stage builds to reduce final image size
- BuildKit cache mechanism improves repeated build performance
Solution: Update Docker to the latest version, or manually install buildx:
# Check if buildx is available
docker buildx version
# If not available, you can install it with:
docker buildx installSolution: Ensure your system has sufficient memory and storage space, as cross-compilation typically requires more resources.
Solution: This is normal behavior, as even on ARM64 hosts, Docker still needs to emulate the Linux ARM64 environment.
After the build is complete, you can check if the image contains multiple architectures:
docker buildx imagetools inspect scrolltech/rollup-node:latest- Development Phase: Use
make dockerfor fast single-architecture builds - Testing Phase: Use
make docker-multiarchfor multi-architecture validation - Release Phase: GitHub Actions will automatically build and push multi-architecture images when you create a release or push a tag
The project includes a GitHub Actions workflow (.github/workflows/release.yml) that automatically builds and pushes multi-architecture images to Docker Hub when:
- A new tag is pushed
- A GitHub release is published
- Multi-platform builds: Automatically builds for
linux/amd64andlinux/arm64 - Smart caching: Uses GitHub Actions cache to speed up builds
- Automatic tagging: Tags images based on Git tags and releases
- Secure authentication: Uses Docker Hub credentials stored in GitHub Secrets
Make sure the following secrets are configured in your GitHub repository:
DOCKERHUB_USERNAME: Your Docker Hub usernameDOCKERHUB_TOKEN: Your Docker Hub access token