Open ipconfiger opened 1 year ago
I'm seeing the same issue
I'm currently having the same issue :/
I got a static binary build to work on my M1 mac using the rust-musl-builder image.
Here is my Dockerfile:
FROM messense/rust-musl-cross:x86_64-musl as chef
# remove the line below when switching to >=rust:1.70.0. sparse mode is planned to be the default in Rust 1.70.0
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV SQLX_OFFLINE=true
RUN cargo install cargo-chef
WORKDIR /rust-api-deployment-example
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /rust-api-deployment-example/recipe.json recipe.json
RUN rustup target add x86_64-unknown-linux-musl
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release --target x86_64-unknown-linux-musl
# We do not need the Rust toolchain to run the binary!
FROM scratch
COPY --from=builder /rust-api-deployment-example/target/x86_64-unknown-linux-musl/release/rust-api-deployment-example /usr/local/bin/rust-api-deployment-example
EXPOSE 3000
ENTRYPOINT [ "rust-api-deployment-example" ]
@letsgetrusty Thanks a lot ! Just so you know, I jumped on the Rust train 2 days ago mainly thanks to your videos so I wanted to address a massive thank you for your work to welcome new rustacean on board. Best regards,
@letsgetrusty I did not expect to see this name here. However, I just wanted to say, you are seriously the best!
What did you try to do?
alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder:latest'
rust-musl-builder cargo build --release
What happened?
╰─$ rust-musl-builder cargo build --release WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested Updating crates.io index %
I run docker run directly, and got:
docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder:latest 137 ↵ WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested To run a command as administrator (user "root"), use "sudo".
See "man sudo_root" for details.
rust@9e4d8a501d78:~/src$ ls Cargo.lock Cargo.toml logs release.sh src target rust@9e4d8a501d78:~/src$ cargo build Updating crates.io index Killed Fetch [======> ] 30.75%, 2.60MiB/s
What did you hope to happen?
finish building
Additional information