From 93fbe6ae6177c630f94cd961a2f98d9b3e742dda Mon Sep 17 00:00:00 2001 From: hackercat Date: Sun, 6 Jun 2021 01:21:31 +0000 Subject: [PATCH] fix: finish rust Dockerfile --- linux/ubuntu/rust/Dockerfile | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/linux/ubuntu/rust/Dockerfile b/linux/ubuntu/rust/Dockerfile index 1696fee..2b0dde2 100644 --- a/linux/ubuntu/rust/Dockerfile +++ b/linux/ubuntu/rust/Dockerfile @@ -1,14 +1,32 @@ -ARG IMAGE=ghcr.io/catthehacker/alpine +ARG IMAGE=ghcr.io/catthehacker/ubuntu ARG TAG=act-latest FROM ${IMAGE}:${TAG} ARG TARGETARCH ARG TARGETVARIANT +ARG RUSTUP_HOME=/usr/share/rust/.rustup +ARG CARGO_HOME=/usr/share/rust/.cargo + SHELL [ "/bin/bash", "--noprofile", "--norc", "-e", "-o", "pipefail", "-c" ] -RUN set -euxo pipefail \ +RUN set -Eeuxo pipefail \ + && printf "Installing dependencies\n" \ + && apt-get -yq update \ + && apt-get -yq install build-essential llvm \ && printf "Installing Rust\n" \ - && curl https://sh.rustup.rs -sSf | sh -s -- -y + && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal \ + && source ${CARGO_HOME}/env \ + && rustup component add rustfmt clippy \ + && cargo install --locked bindgen cbindgen cargo-audit cargo-outdated \ + && chmod -R 777 $(dirname ${RUSTUP_HOME}) \ + && rm -rf ${CARGO_HOME}/registry/* \ + && sed "s|PATH=\"|PATH=\"${CARGO_HOME}/bin:|g" -i /etc/environment \ + && sed 's|"||g' -i /etc/environment \ + && cd /root \ + && ln -sf ${CARGO_HOME} .cargo \ + && ln -sf ${RUSTUP_HOME} .rustup \ + && echo "RUSTUP_HOME=${RUSTUP_HOME}" | tee -a /etc/environment \ + && echo "CARGO_HOME=${CARGO_HOME}" | tee -a /etc/environment ARG BUILD_TAG_VERSION="dev" ARG BUILD_TAG="rust"