Skip to content

Commit 7a8c58f

Browse files
authored
[Feature:Autograding] Add Rust Dockerfile (#46)
### Please check if the PR fulfills these requirements: * [ ] Tests for the changes have been added/updated (if possible) * [ ] Documentation has been updated/added if relevant ### What is the current behavior? <!-- List issue if it fixes/closes/implements one using the "Fixes #<number>" or "Closes #<number>" syntax --> ### What is the new behavior? Creates a barebones Ubuntu image with the rust compiler (rustc) and package manager (cargo). ### Other information? <!-- Is this a breaking change? --> <!-- How did you test --> Tested by creating a gradeable using this image and was able to compile and execute rust source in autograder.
1 parent 2fbdfbe commit 7a8c58f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

dockerfiles/rust/1.75/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM ubuntu:22.04
2+
3+
ENV RUSTUP_HOME=/usr/local/rustup \
4+
CARGO_HOME=/usr/local/cargo \
5+
PATH=/usr/local/cargo/bin:$PATH \
6+
RUST_VERSION=1.75.0
7+
8+
RUN set -eux; \
9+
apt-get update; \
10+
apt-get install -y --no-install-recommends \
11+
ca-certificates \
12+
gcc \
13+
libc6-dev \
14+
wget \
15+
; \
16+
dpkgArch="$(dpkg --print-architecture)"; \
17+
case "${dpkgArch##*-}" in \
18+
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \
19+
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \
20+
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \
21+
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \
22+
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
23+
esac; \
24+
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
25+
wget "$url"; \
26+
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
27+
chmod +x rustup-init; \
28+
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION; \
29+
rm rustup-init; \
30+
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
31+
rustup --version; \
32+
cargo --version; \
33+
rustc --version; \
34+
apt-get remove -y --auto-remove \
35+
wget \
36+
; \
37+
rm -rf /var/lib/apt/lists/*;

dockerfiles/rust/metadata.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"pushLatest": true,
3+
"latestTag": "1.75"
4+
}

0 commit comments

Comments
 (0)