I am trying to build a Docker container that includes Rust and mdbook. I have tried a number of variations on
FROM rust:latest
RUN cargo install mdbook
including specifying the exact versions. For example, these don't work work either
RUN cargo install --git https://github.com/rust-lang-nursery/mdBook.git mdbook
and
RUN cargo install mdbook --vers "^0.1.0"
Things fail when the install gets to compiling 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
Instead of using the Rust container from Docker, you can build your own. The version of Rust is still 1.30 (as with FROM rust:latest
), but for some reason this procedure gets all the dependencies right.
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