Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ incremental = true

[target.x86_64-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]

# Use lld linker on Linux — significantly less memory than default ld,
# critical for arm64 builds on 16GB Graviton runners.
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"]

[target.aarch64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"]
6 changes: 5 additions & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use a Rust base image
FROM rust:bookworm AS builder
ARG BUILD_TYPE
RUN apt-get update && apt-get install -y libclang-dev cmake libssl-dev libc++-dev libc++abi-dev lld
RUN apt-get update && apt-get install -y clang libclang-dev cmake libssl-dev libc++-dev libc++abi-dev lld

# Install nvm, npm and node
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
Expand Down Expand Up @@ -36,6 +36,10 @@ COPY . .
RUN rustup default 1.88
RUN rustup component add rustfmt

# Limit parallel jobs to prevent OOM on arm64 (16GB Graviton).
# lld linker configured in .cargo/config.toml (uses ~3x less RAM than ld).
ENV CARGO_BUILD_JOBS=4

# Build main code, pre-compile tests, and cleanup in SINGLE layer
# This is critical - separate RUN commands create Docker layers that preserve old data
# Even if we delete files in a later layer, the image size includes all layers
Expand Down
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ARG VCS_REF

# Install build dependencies
RUN apt-get update && apt-get install -y \
clang \
libclang-dev \
cmake \
libssl-dev \
Expand All @@ -43,6 +44,10 @@ COPY . .
# Add rustfmt for build
RUN rustup component add rustfmt

# Limit parallel codegen/linker jobs to prevent OOM on arm64 (16GB Graviton).
# lld is configured as the linker via .cargo/config.toml (uses ~3x less RAM than ld).
ENV CARGO_BUILD_JOBS=4

# Build the project
# Build the entire workspace to properly resolve all dependencies
# Then extract just the hanzo_node binary we need
Expand Down
Loading