Fix Rust installation

There were a number of issues:

1. `rustc` wasn't actually installed since the `INSTALL_RUST_VERSION`
argument wasn't set.

2. `rustup` wasn't running properly since the `CARGO_HOME` and
`RUSTUP_HOME`weren't being exported and set by default. We now use the
technique described in https://github.com/rust-lang/rustup/issues/1085
to create a wrapper and link all the binaries in /opt/rust/bin and
link them to /usr/local/bin.

3. `rustc version` is not a valid command. `rustc --version` is valid.
This commit is contained in:
Stan Hu 2023-01-18 15:00:41 -08:00
parent a5ac3f8e7f
commit 9e04d5d21a
No known key found for this signature in database
GPG key ID: 8D3931AD39CC7A20
3 changed files with 19 additions and 6 deletions

View file

@ -17,12 +17,12 @@ RUN /scripts/install-essentials ${BUILD_OS}
ENV PATH $PATH:/usr/local/go/bin
ENV PATH /usr/local/cargo/bin:$PATH
ENV PATH /usr/local/bin:$PATH
# Rust
ARG INSTALL_RUST_VERSION
RUN if [ -n "$INSTALL_RUST_VERSION" ] ; then /scripts/install-rust "${INSTALL_RUST_VERSION}" && rustc version; fi
RUN if [ -n "$INSTALL_RUST_VERSION" ] ; then /scripts/install-rust "${INSTALL_RUST_VERSION}" && rustc --version; fi
# Ruby
ARG RUBY_VERSION