Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Binaries for ARM-based Architectures #1192

Closed
medelman17 opened this issue Jun 6, 2022 · 2 comments · Fixed by #1907
Closed

Release Binaries for ARM-based Architectures #1192

medelman17 opened this issue Jun 6, 2022 · 2 comments · Fixed by #1907
Assignees

Comments

@medelman17
Copy link
Contributor

medelman17 commented Jun 6, 2022

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.
Screen Shot 2022-06-05 at 9 06 58 PM

See also #65

@hobbsh
Copy link
Contributor

hobbsh commented Jul 11, 2022

@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?

@hobbsh
Copy link
Contributor

hobbsh commented Jul 11, 2022

For anyone who comes across this, I have a dirty workaround (pulled from here: apollographql/rover#582 (comment))

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"]

abernix added a commit that referenced this issue Sep 29, 2022
This PR adds builds, tests, and releases for the
`aarch64-unknown-linux-gnu` target.

Closes #1192

Co-authored-by: Jesse Rosenberger <git@jro.cc>
Co-authored-by: Gary Pennington <gary@apollographql.com>
This was referenced Sep 29, 2022
@abernix abernix removed the triage label Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants