-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide image with only rustup #107
Comments
This seems pretty reasonable to me I think. We'd probably want to call the image |
This would be especially handy for CI when you have multiple targets managed by |
FYI here's my way of using FROM scratch AS rustup
ADD --chmod=0755 --checksum=sha256:6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d \
https://static.rust-lang.org/rustup/archive/1.27.1/x86_64-unknown-linux-gnu/rustup-init /rustup-init
FROM docker.io/library/debian:12-slim@sha256:2ccc7e39b0a6f504d252f807da1fc4b5bcd838e83e4dec3e2f57b2a4a64e7214 AS rust-base
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN \
set -ux \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev
RUN \
--mount=from=rustup,source=/rustup-init,target=/rustup-init \
set -ux \
&& /rustup-init -y --no-modify-path --profile minimal --default-toolchain nightly-2024-08-14 --default-host x86_64-unknown-linux-gnu \
&& chmod -R a+w $RUSTUP_HOME $CARGO_HOME \
&& rustup --version \
&& cargo --version \
&& rustc --version \
&& apt-get remove -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
# clean up for reproducibility
&& rm -rf /var/log/* /var/cache/ldconfig/aux-cache One should be able to generalize and trim this to provide a single layer ( |
Do you think it would be possible to provide Dockerfile that only installs rustup?
It would be useful for people who are fine with stable rustup but would like to use any version of rust via rust-toolchain file.
I'm not a Docker expert but I think it could be the same as the image in this repository except installing cargo. I've been using the example below for quite a while with cached several directories (
--mount=type=cache,target="/usr/local/rustup" --mount=type=cache,target="/usr/local/cargo/git" --mount=type=cache,target="/usr/local/cargo/registry" --mount=type=cache,target="/src/target",sharing=private
):The text was updated successfully, but these errors were encountered: