38 lines
1.3 KiB
Docker
38 lines
1.3 KiB
Docker
# Rust stack overlay fragment.
|
|
#
|
|
# Layer this on top of huskies-project-base to produce a project container
|
|
# with a full Rust toolchain, rust-analyzer, and cargo-nextest.
|
|
#
|
|
# Build the combined image:
|
|
# (echo "FROM huskies-project-base"; \
|
|
# cat docker/stacks/rust/Dockerfile.fragment) | \
|
|
# docker build -t huskies-project-rust -
|
|
#
|
|
# Adding a new stack: create docker/stacks/<name>/Dockerfile.fragment and
|
|
# docker/stacks/<name>/markers — no changes to orchestration code required.
|
|
|
|
USER root
|
|
|
|
# Build tools required by rustup and many Rust crates.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
pkg-config \
|
|
libssl-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV RUSTUP_HOME="/home/huskies/.rustup" \
|
|
CARGO_HOME="/home/huskies/.cargo"
|
|
|
|
# Install stable Rust + rust-analyzer component as the huskies user.
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| su huskies -c "sh -s -- -y --no-modify-path --default-toolchain stable" \
|
|
&& /home/huskies/.cargo/bin/rustup component add rust-analyzer \
|
|
&& chown -R huskies:huskies /home/huskies/.rustup /home/huskies/.cargo
|
|
|
|
# cargo-nextest: fast Rust test runner used by huskies quality gates.
|
|
RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C /usr/local/bin
|
|
|
|
ENV PATH="/home/huskies/.cargo/bin:${PATH}"
|
|
|
|
USER huskies
|