rust-lang / rust-lang/docker-rust

Provide image with only rustup

Open
#107 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dockerfile
Stars
537
Forks
111
Avg merge
1d 38m
Merged PRs (30d)
4

Description

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):

# syntax=docker/dockerfile:1.3

FROM buildpack-deps:bullseye AS builder

ARG RUSTUP_HOME=/usr/local/rustup
ARG CARGO_HOME=/usr/local/cargo

ENV RUSTUP_HOME=${RUSTUP_HOME} \
    CARGO_HOME=${CARGO_HOME} \
    PATH=${CARGO_HOME}/bin:$PATH \
    GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

RUN set -eux; \
    dpkgArch="$(dpkg --print-architecture)"; \
    case "${dpkgArch##*-}" in \
        amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='3dc5ef50861ee18657f9db2eeb7392f9c2a6c95c90ab41e45ab4ca71476b4338' ;; \
        armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='67777ac3bc17277102f2ed73fd5f14c51f4ca5963adadf7f174adf4ebc38747b' ;; \
        arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='32a1532f7cef072a667bac53f1a5542c99666c4071af0c9549795bbdb2069ec1' ;; \
        i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e50d1deb99048bc5782a0200aa33e4eea70747d49dffdc9d06812fd22a372515' ;; \
        *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
    esac; \
    url="https://static.rust-lang.org/rustup/archive/1.24.3/${rustArch}/rustup-init"; \
    wget "$url"; \
    echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
    chmod +x rustup-init; \
    ./rustup-init -y --no-modify-path --profile minimal --default-toolchain none --default-host ${rustArch}; \
    rm rustup-init; \
    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
    rustup --version;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the existing Rust image Dockerfile in the repository with the Dockerfile example in this issue, including its rustup installation and architecture handling. Confirm how images are built and published, then verify that the resulting image provides rustup without a default toolchain and can honor a rust-toolchain file.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile, rust
Domain
build-system, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.