我正在尝试构建一个包含Rust和mdbook的Docker容器。我已经尝试了很多变种。
FROM rust:latest
RUN cargo install mdbook
包括指定确切的版本。例如,这些也不能工作
RUN cargo install --git https://github.com/rust-lang-nursery/mdBook.git mdbook
和
RUN cargo install mdbook --vers "^0.1.0"
当安装到编译lazycell v1.2.0时会失败:
Compiling lazycell v1.2.0
error: `<core::cell::UnsafeCell<T>>::new` is not yet stable as a const fn
--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/lazycell-1.2.0/src/lib.rs:233:16
|
233 | inner: UnsafeCell::new(None),
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: in Nightly builds, add `#![feature(const_unsafe_cell_new)]` to the crate attributes to enable
发布于 2018-10-31 07:01:19
您可以构建自己的Rust容器,而不是使用Docker的Rust容器。Rust的版本仍然是1.30 (与FROM rust:latest
一样),但由于某些原因,此过程会正确地处理所有依赖项。
FROM ubuntu:latest
FROM gcc:latest
RUN apt-get update && \
apt-get install -y curl
WORKDIR /tmp
RUN curl https://sh.rustup.rs -sSf > rustup.sh
RUN chmod 755 rustup.sh
RUN ./rustup.sh -y
RUN rm /tmp/rustup.sh
RUN ~/.cargo/bin/cargo install mdbook
https://stackoverflow.com/questions/53072786
复制相似问题