router
router copied to clipboard
Release Binaries for ARM-based Architectures
Describe the solution you'd like
As a developer building supergraphs on and or for deployment to ARM-based architectures/environments, I need suitable static binaries to be made at the ready for each release so that I can get up and running on my Apple silicon, RaspberryPi, Graviton-backed cloud functions, etc, quickly and without fanfare.
Describe alternatives you've considered
I can build binaries from source that target the above mentioned environments no problem; however, that's a point of friction that I could do without. Running x86_64 in an emulated environment is a non-starter.
Additional context
Writing this issue whilst building router on a RaspberryPi Zero 2W (1GHz quad-core 64-bit Arm Cortext-A53 CPU). So, suffice it to say, lots of idle time on my hands.

See also #65
@medelman17 Trying to understand what the blockers are for this as it's a huge issue for us running the router locally. Do you have any pointers on how to potentially cross-compile the router and build our own docker image? Could it be as simple as something like RUN cargo build --release --target aarch64-unknown-linux-gnu in a separate dockerfile? I notice there's --platform linux/amd64 all over the existing dockerfiles so am anticipating it could be a headache to untangle that web of dependencies, but maybe not?
For anyone who comes across this, I have a dirty workaround (pulled from here: https://github.com/apollographql/rover/issues/582#issuecomment-1107648470)
We are using this docker image to run the router locally in kubernetes on M1 Macs, although who knows what could go wrong. While I find the necessity of this wholly unacceptable from an organization like Apollo (if you want to lead the GraphQL movement, you need to support your end users!), here is the Dockerfile:
docker build --target=final -t <SOME TAG> .
FROM rust:latest AS builder
ARG router_version=0.10.0
RUN apt update && apt-get install -y gcc-aarch64-linux-gnu npm g++-aarch64-linux-gnu libc6-dev-arm64-cross
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc \
CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++
# Build router
WORKDIR /router
RUN git clone https://github.com/apollographql/router --depth=1 --branch v$router_version /router
# install the toolchain specified by the project
RUN rustup show
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup default 1.60.0
RUN rustup target add aarch64-unknown-linux-gnu
RUN cargo build --release --target aarch64-unknown-linux-gnu
FROM debian:bullseye-slim AS final
WORKDIR /router
RUN apt-get update && apt-get -y install openssl ca-certificates && rm -rf /var/lib/apt/lists/*
COPY --from=builder /router/target/aarch64-unknown-linux-gnu/release/router .
# Default executable is the router
ENTRYPOINT ["./router"]