Skip to content

Commit 7280adc

Browse files
feat(aptos): adds support for arm64 (#1855)
* feat(aptos): adds support for arm64 * chore: add platform arch * changeset --------- Co-authored-by: skudasov <[email protected]>
1 parent e62f3f0 commit 7280adc

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

framework/.changeset/v0.8.6.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Aptos support for arm64

framework/components/blockchain/aptos.go

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"path/filepath"
7+
"runtime"
78
"strings"
89

910
"github.com/docker/docker/api/types/container"
@@ -14,8 +15,10 @@ import (
1415
)
1516

1617
const (
17-
DefaultAptosAPIPort = "8080"
18-
DefaultAptosFaucetPort = "8081"
18+
DefaultAptosAPIPort = "8080"
19+
DefaultAptosFaucetPort = "8081"
20+
DefaultAptosArm64Image = "ghcr.io/friedemannf/aptos-tools:aptos-node-v1.30.2-rc"
21+
DefaultAptosX86_64Image = "aptoslabs/tools:aptos-node-v1.27.2"
1922
)
2023

2124
var (
@@ -25,7 +28,16 @@ var (
2528

2629
func defaultAptos(in *Input) {
2730
if in.Image == "" {
28-
in.Image = "aptoslabs/tools:aptos-node-v1.27.2"
31+
// Aptos doesn't support an official arm64 image yet, so we use a custom image for now
32+
// CI Runners use x86_64 images, so CI checks will use the official image
33+
if runtime.GOARCH == "arm64" {
34+
// Uses an unofficial image built for arm64
35+
framework.L.Warn().Msgf("Using unofficial Aptos image for arm64 %s", DefaultAptosArm64Image)
36+
in.Image = DefaultAptosArm64Image
37+
} else {
38+
// Official Aptos image
39+
in.Image = DefaultAptosX86_64Image
40+
}
2941
}
3042
framework.L.Warn().Msgf("Aptos node API can only be exposed on port %s!", DefaultAptosAPIPort)
3143
if in.Port == "" {
@@ -68,6 +80,14 @@ func newAptos(in *Input) (*Output, error) {
6880
cmd = append(cmd, in.DockerCmdParamsOverrides...)
6981
}
7082

83+
// Set image platform based on architecture
84+
var imagePlatform string
85+
if runtime.GOARCH == "arm64" {
86+
imagePlatform = "linux/arm64"
87+
} else {
88+
imagePlatform = "linux/amd64"
89+
}
90+
7191
req := testcontainers.ContainerRequest{
7292
Image: in.Image,
7393
ExposedPorts: exposedPorts,
@@ -82,7 +102,7 @@ func newAptos(in *Input) (*Output, error) {
82102
h.PortBindings = bindings
83103
framework.ResourceLimitsFunc(h, in.ContainerResources)
84104
},
85-
ImagePlatform: "linux/amd64",
105+
ImagePlatform: imagePlatform,
86106
Cmd: cmd,
87107
Files: []testcontainers.ContainerFile{
88108
{

0 commit comments

Comments
 (0)