Skip to content

Commit b131408

Browse files
authored
Merge pull request #1337 from o1-labs/dw/push-arm-x86
Docker: push multi platform architecture
2 parents 8693fce + b405aec commit b131408

File tree

4 files changed

+85
-10
lines changed

4 files changed

+85
-10
lines changed

.github/workflows/docker.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99

1010
jobs:
1111
build-mina-node-image:
12+
if: github.ref != 'refs/heads/develop' && !startsWith(github.ref, 'refs/tags/')
1213
timeout-minutes: 40
1314
strategy:
1415
matrix:
@@ -61,6 +62,7 @@ jobs:
6162

6263
# Frontend
6364
build-mina-frontend-image:
65+
if: github.ref != 'refs/heads/develop' && !startsWith(github.ref, 'refs/tags/')
6466
timeout-minutes: 5
6567
strategy:
6668
matrix:
@@ -112,12 +114,24 @@ jobs:
112114

113115
# Push images to registry
114116
push-images:
115-
runs-on: ubuntu-latest
117+
strategy:
118+
matrix:
119+
arch:
120+
- platform: linux/amd64
121+
runs-on: ubuntu-latest
122+
- platform: linux/arm64
123+
runs-on: ubuntu-24.04-arm
124+
runs-on: ${{ matrix.arch.runs-on }}
116125
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')
117126
steps:
118127
- name: Git checkout
119128
uses: actions/checkout@v5
120129

130+
# This is needed so that we can get the current version with vergen
131+
- name: Fetch tag for current commit
132+
run: |
133+
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
134+
121135
- name: Login to Docker Hub
122136
uses: docker/login-action@v3
123137
with:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5050
- **Node**: add `openmina misc mina-encrypted-key` to generate a new encrypted
5151
key with password, as the OCaml node provides
5252
([#1284](https://github.com/o1-labs/openmina/pull/1284/)).
53+
- **CI**: push images on tags and develop to
54+
[o1labs/mina-rust-frontend](https://hub.docker.com/r/o1labs/mina-rust-frontend)
55+
and [o1labs/mina-rust](https://hub.docker.com/r/o1labs/mina-rust), and support
56+
ARM and AMD64, fixing
57+
[!1336](https://github.com/o1-labs/mina-rust/issues/1336),
58+
[!1192](https://github.com/o1-labs/mina-rust/issues/1192)
59+
([#1337](https://github.com/o1-labs/mina-rust/pull/1337),
60+
[#1335](https://github.com/o1-labs/mina-rust/pull/1335))
5361

5462
### Changed
5563

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,17 @@ docker-build-debugger: ## Build debugger Docker image
291291

292292
.PHONY: docker-build-frontend
293293
docker-build-frontend: ## Build frontend Docker image
294-
@docker build -t $(DOCKER_ORG)/mina-rust-frontend:$(GIT_COMMIT) frontend/
294+
@ARCH=$$(uname -m); \
295+
case $$ARCH in \
296+
x86_64) PLATFORM="linux/amd64" ;; \
297+
aarch64|arm64) PLATFORM="linux/arm64" ;; \
298+
*) echo "Unsupported architecture: $$ARCH" && exit 1 ;; \
299+
esac; \
300+
echo "Building for platform: $$PLATFORM"; \
301+
docker buildx build \
302+
--platform $$PLATFORM \
303+
--tag $(DOCKER_ORG)/mina-rust-frontend:$(GIT_COMMIT) \
304+
frontend/
295305

296306
.PHONY: docker-build-fuzzing
297307
docker-build-fuzzing: ## Build fuzzing Docker image
@@ -314,7 +324,17 @@ docker-build-light-focal: ## Build light focal Docker image
314324

315325
.PHONY: docker-build-mina
316326
docker-build-mina: ## Build main Mina Docker image
317-
@docker build -t $(DOCKER_ORG)/mina-rust:$(GIT_COMMIT) .
327+
@ARCH=$$(uname -m); \
328+
case $$ARCH in \
329+
x86_64) PLATFORM="linux/amd64" ;; \
330+
aarch64|arm64) PLATFORM="linux/arm64" ;; \
331+
*) echo "Unsupported architecture: $$ARCH" && exit 1 ;; \
332+
esac; \
333+
echo "Building for platform: $$PLATFORM"; \
334+
docker buildx build \
335+
--platform $$PLATFORM \
336+
--tag $(DOCKER_ORG)/mina-rust:$(GIT_COMMIT) \
337+
.
318338

319339
.PHONY: docker-build-mina-testing
320340
docker-build-mina-testing: ## Build Mina testing Docker image

website/docs/developers/docker-images.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,52 @@ make docker-push-frontend
7272

7373
## Architecture Support
7474

75-
Images are built for multiple architectures:
75+
All Docker images are built natively for multiple architectures to ensure
76+
optimal performance:
7677

77-
- `linux/amd64` (x86_64)
78-
- `linux/arm64` (ARM64)
78+
- **`linux/amd64`** (x86_64) - For Intel/AMD processors
79+
- **`linux/arm64`** (ARM64) - For ARM processors (Apple Silicon, AWS Graviton,
80+
etc.)
81+
82+
### Automatic Architecture Selection
83+
84+
Docker automatically pulls the correct architecture for your system:
85+
86+
```bash
87+
# This automatically pulls the right architecture
88+
docker pull o1labs/mina-rust:latest
89+
90+
# On Intel/AMD systems: gets linux/amd64
91+
# On Apple Silicon: gets linux/arm64
92+
# On ARM servers: gets linux/arm64
93+
```
94+
95+
### Performance Benefits
96+
97+
- **Native builds**: Each architecture is compiled natively for optimal
98+
performance
99+
- **No emulation overhead**: ARM users get native performance instead of x86
100+
emulation
101+
- **Faster startup**: Native images start faster than emulated ones
102+
103+
### Verifying Architecture
104+
105+
You can verify which architecture you're running:
106+
107+
```bash
108+
docker run --rm o1labs/mina-rust:latest uname -m
109+
# x86_64 on Intel/AMD systems
110+
# aarch64 on ARM systems
111+
```
79112

80113
## Using Docker Images
81114

82115
### Running a Basic Node
83116

84117
```bash
85118
# Pull and run the main node
86-
docker pull o1labs/mina-rust:v1.4.2
87-
docker run -p 8302:8302 o1labs/mina-rust:v1.4.2
119+
docker pull o1labs/mina-rust:latest
120+
docker run -p 8302:8302 o1labs/mina-rust:latest
88121
```
89122

90123
### Running with Frontend Dashboard
@@ -94,8 +127,8 @@ docker run -p 8302:8302 o1labs/mina-rust:v1.4.2
94127
# Download the latest release and use the provided docker-compose files
95128

96129
# Or run containers separately
97-
docker run -d --name mina-node -p 8302:8302 o1labs/mina-rust:v1.4.2
98-
docker run -d --name mina-frontend -p 8070:8070 o1labs/mina-rust-frontend:v1.4.2
130+
docker run -d --name mina-node -p 8302:8302 o1labs/mina-rust:latest
131+
docker run -d --name mina-frontend -p 8070:8070 o1labs/mina-rust-frontend:latest
99132
```
100133

101134
For complete setup guides, see the

0 commit comments

Comments
 (0)