11# Cross-compilation optimized Dockerfile for ARM64
2- FROM --platform=linux/amd64 rust:1.85 as rust-cross-builder
2+ FROM --platform=linux/amd64 rust:1.85 AS rust-cross-builder
33
44# Install cross-compilation dependencies
5- RUN apt-get update && apt-get install -y \
5+ RUN dpkg --add-architecture arm64 && \
6+ apt-get update && apt-get install -y \
67 make \
78 build-essential \
89 pkg-config \
@@ -11,6 +12,8 @@ RUN apt-get update && apt-get install -y \
1112 gcc-aarch64-linux-gnu \
1213 g++-aarch64-linux-gnu \
1314 libc6-dev-arm64-cross \
15+ libssl-dev:arm64 \
16+ libssl-dev \
1417 && rm -rf /var/lib/apt/lists/*
1518
1619# Install cross-compilation target
@@ -23,6 +26,13 @@ ENV CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
2326ENV AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar
2427ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64
2528
29+ # Configure OpenSSL for cross-compilation
30+ ENV PKG_CONFIG_ALLOW_CROSS=1
31+ ENV PKG_CONFIG_PATH_aarch64_unknown_linux_gnu=/usr/lib/aarch64-linux-gnu/pkgconfig
32+ ENV OPENSSL_DIR=/usr
33+ ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu
34+ ENV OPENSSL_INCLUDE_DIR=/usr/include/openssl
35+
2636# Optimize Rust compilation
2737ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
2838ENV CARGO_INCREMENTAL=1
@@ -96,7 +106,7 @@ RUN echo "Building Rust library with actual source code..." && \
96106 find target -name "*.so" -type f
97107
98108# Build the Go application
99- FROM --platform=linux/amd64 golang:1.24 as go-builder
109+ FROM --platform=linux/amd64 golang:1.24 AS go-builder
100110
101111# Install cross-compilation tools for Go
102112RUN apt-get update && apt-get install -y \
0 commit comments