rust/Dockerfile

52 lines
1.8 KiB
Docker

FROM debian:buster-slim
ENV TZ=Europe/Moscow
ENV TERM=xterm-color
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH
ENV RUST_ARCH=x86_64-unknown-linux-gnu
ENV RUST_VERSION=1.40.0
ENV RUSTUP_VERSION=1.21.1
ENV RUSTUP_SHA256=ad1f8b5199b3b9e231472ed7aa08d2e5d1d539198a15c5b1e53c746aad81d27b
ENV CARGO_CACHE_VERSION=0.3.3
ENV CARGO_OUTDATED_VERSION=v0.9.1
ENV CARGO_TREE_VERSION=v0.28.0
RUN \
apt-get update && \
apt-get install -y --no-install-recommends ca-certificates cmake curl gcc git libc6-dev libssl-dev make pkg-config && \
rm -rf /var/lib/apt/lists/*
RUN \
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone && date
RUN \
# download rustup
curl --silent --show-error --location https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${RUST_ARCH}/rustup-init --output rustup-init && \
echo "${RUSTUP_SHA256} *rustup-init" | sha256sum -c - && \
chmod +x rustup-init && \
# install rust
./rustup-init -y --no-modify-path --profile minimal --default-host ${RUST_ARCH} --default-toolchain ${RUST_VERSION} && \
rm rustup-init && \
chmod -R a+w ${RUSTUP_HOME} ${CARGO_HOME} && \
# add clippy component
rustup component add clippy && \
# add rustfmt component
rustup component add rustfmt && \
# install cargo-cache
cargo install cargo-cache --force --git https://github.com/matthiaskrgr/cargo-cache.git --tag ${CARGO_CACHE_VERSION} && \
# install cargo-outdated
cargo install cargo-outdated --force --git https://github.com/kbknapp/cargo-outdated.git --tag ${CARGO_OUTDATED_VERSION} && \
# install cargo-tree
cargo install cargo-tree --force --git https://github.com/sfackler/cargo-tree.git --tag ${CARGO_TREE_VERSION} && \
# cleanup
cargo cache -r all && \
# print versions
rustup --version && \
cargo --version && \
rustc --version