FROM trusted-agent-default:latest

USER root
# Rust (stable, minimal profile + clippy/rustfmt). Installed system-wide under
# /usr/local so the non-root `node` user can use it; the tree is world-writable
# so cargo can populate its registry cache under $CARGO_HOME at build time.
ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH
RUN curl -fsSL https://sh.rustup.rs \
        | sh -s -- -y --default-toolchain stable --profile minimal --no-modify-path \
    && rustup component add clippy rustfmt \
    && chmod -R a+rw "$RUSTUP_HOME" "$CARGO_HOME"
USER node
