Skip to content

Commit 1db6810

Browse files
authored
Install rust into user independed location (#87)
1 parent e4fc8fb commit 1db6810

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

docker/debian/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ EOF
9898

9999
# Install rust.
100100
ARG RUST_VERSION
101-
RUN <<EOF
102-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
103-
EOF
101+
ENV CARGO_HOME="/opt/rust/.cargo"
102+
ENV RUSTUP_HOME="/opt/rust/.rustup"
103+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
104+
ENV PATH="$CARGO_HOME/bin:$PATH"
104105

105106
# Print versions.
106107
RUN <<EOF
@@ -112,8 +113,6 @@ gcovr --version
112113
ld.gold --version
113114
mold --version
114115
python3 --version
115-
. ~/.bashrc
116-
. ~/.cargo/env
117116
rustc --version
118117
cargo --version
119118
EOF

docker/rhel/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ EOF
112112

113113
# Install rust.
114114
ARG RUST_VERSION
115-
RUN <<EOF
116-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
117-
EOF
115+
ENV CARGO_HOME="/opt/rust/.cargo"
116+
ENV RUSTUP_HOME="/opt/rust/.rustup"
117+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
118+
ENV PATH="$CARGO_HOME/bin:$PATH"
118119

119120
# Print versions.
120121
RUN <<EOF
@@ -126,8 +127,6 @@ gcovr --version
126127
ld.gold --version
127128
mold --version
128129
python3 --version
129-
. ~/.bashrc
130-
. ~/.cargo/env
131130
rustc --version
132131
cargo --version
133132
EOF

docker/ubuntu/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ EOF
8484

8585
# Install rust.
8686
ARG RUST_VERSION
87-
RUN <<EOF
88-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
89-
EOF
87+
ENV CARGO_HOME="/opt/rust/.cargo"
88+
ENV RUSTUP_HOME="/opt/rust/.rustup"
89+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${RUST_VERSION}
90+
ENV PATH="$CARGO_HOME/bin:$PATH"
9091

9192
# Print versions.
9293
RUN <<EOF
@@ -98,8 +99,6 @@ gcovr --version
9899
ld.gold --version
99100
mold --version
100101
python3 --version
101-
. ~/.bashrc
102-
. ~/.cargo/env
103102
rustc --version
104103
cargo --version
105104
EOF

0 commit comments

Comments
 (0)