虽然这个命令上周还能正常运行,但我现在在构建我的 Rust 应用程序的 Docker 镜像时,该命令突然失败了 -。
我的 Docker 文件如下:
这个问题有解决办法吗?为什么 Cargo 尝试从“edition 2021”下载,尽管已经指定了“edition 2018”?而且为什么它会下载几乎所有的库,即使在任何地方都没有指定呢?
RUN cargo install --target x86_64-unknown-linux-musl --path .
有错误的内容-
编译ed25519 v1.4.0 错误:版本2021不稳定,仅在使用-Z unstable-options时可用。
错误:无法编译config-client v0.1.0 (/home/rust/src)
,中间产物可以在/home/rust/src/target
找到
造成原因:
无法编译ed25519
以下是我的Cargo.toml文件:
[package]
name = "application-xyz"
version = "0.1.0"
authors = ["Dev Team <dev@abc.com>"]
edition = "2018"
[dependencies]
anyhow = "1.0"
bytes = "1.0.1"
clap = "2.33.3"
log = "0.4.14"
log4rs = "1.0.0"
mustache = "0.9.0"
nats = "0.9.7"
prost = "0.7"
prost-types = "0.7"
reqwest = { version = "0.11.3", features = ["blocking", "json"] }
serde = { version = "1.0.125", features = ["derive"] }
[build-dependencies]
prost-build = "0.7"
我的 Docker 文件如下:
FROM containers.abc.com/rust-musl-builder:1.51 as builder
#Add protobuf sources as well as app source code.
COPY model/src ./model/src
COPY application-xyz:/build.rs ./build.rs
COPY application-xyz:/Cargo.toml ./Cargo.toml
COPY application-xyz:/src ./src
COPY application-xyz:/src/protobuf ./src/protobuf
RUN cargo install --target x86_64-unknown-linux-musl --path .
这个问题有解决办法吗?为什么 Cargo 尝试从“edition 2021”下载,尽管已经指定了“edition 2018”?而且为什么它会下载几乎所有的库,即使在任何地方都没有指定呢?