Deploying from Mac does not work

I’m trying to deploy a fresh Axum app but it gives me this error:

2.106 /bin/sh: 1: ./rustup-init: Exec format error
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c set -eux; \t\tcurl --location --fail \t\t\t\"https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init\" \t\t\t--output rustup-init; \t\tchmod +x rustup-init; \t\t./rustup-init -y --no-modify-path --default-toolchain stable; \t\trm rustup-init;" did not complete successfully: exit code: 2

No idea what’s going on or why.

This suggests you’re uploading and trying to run a Mac/arm64 binary to Fly’s Linux/amd64-based builders, which is obviously going to fail as the binary is not compatible with that architecture.

I’m not sure where rustup-init comes from, but you need to ensure this binary is amd64, i.e. don’t upload the one you have in your local project directory on your Mac, but make sure either the Dockerfile or base image gets and/or provides an amd64 rustup-init.

If you share your Dockerfile people might be able to pinpoint what needs to be done :slight_smile:

I have no idea why or how I would upload a Mac binary to Fly. This is all Fly automatically doing… something.

FROM ubuntu:20.04

RUN set -eux; \
    apt update; \
	apt install -y --no-install-recommends curl ca-certificates gcc libc6-dev pkg-config libssl-dev;

# Change this from: https://rust-lang.github.io/rustup/installation/other.html
RUN set -eux; \
		curl --location --fail \
			"https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init" \
			--output rustup-init; \
		chmod +x rustup-init; \
		./rustup-init -y --no-modify-path --default-toolchain stable; \
		rm rustup-init;

ENV PATH=${PATH}:/root/.cargo/bin

RUN set -eux; \
		rustup --version;


WORKDIR /app

COPY src src
COPY templates templates
COPY .env .env
COPY 20221002.sqlite 20221002.sqlite
COPY Cargo.toml Cargo.toml

RUN set -eux; \
	cargo build --release; \
    cp target/release/cuppings .

CMD ["/app/cuppings"]

Which I think is entirely autogenerated.

aarch64-unknown-linux-gnu/rustup-init is ARM isn’t it?

I patched the rustup install in the Dockerfile with this:

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

So now it at least goes to compilation but still errors there for reasons I can’t really figure out (locally it builds).

It could be. Not sure why it got generated that way.

https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init probably needs to be changed to https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init.

I think the scanner just takes the running host’s architecture identifier when creating the Dockerfile, which is probably wrong. I’ll flag this on our side to get it fixed.

But you should be able to get things running by doing the above change in the Dockerfile and then doing fly deploy.

OK. That makes sense. Now to try again as soon as Depot grants me a builder.

My final error seems to be sqlformat shipping a breaking change: Latest patch release seems to contain a breaking change · Issue #54 · shssoichiro/sqlformat-rs · GitHub

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.