1
1
FROM codewars/base-runner
2
2
3
- RUN ln -s /home/codewarrior /workspace
4
-
5
- COPY frameworks/rust/skeleton /workspace/rust
6
- RUN chown -R codewarrior:codewarrior /workspace/rust
7
-
8
- USER codewarrior
9
- ENV USER=codewarrior HOME=/home/codewarrior
3
+ # based on the Dockerfile for https://hub.docker.com/_/rust/
4
+ ENV RUSTUP_HOME=/usr/local/rustup \
5
+ CARGO_HOME=/usr/local/cargo \
6
+ PATH=/usr/local/cargo/bin:$PATH
7
+ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain 1.15.1; \
8
+ chmod -R a+w $RUSTUP_HOME $CARGO_HOME;
10
9
11
- # Install rustup with the Rust v1.15.1 toolchain
12
- RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.15.1
13
- # ~/.cargo/env
14
- ENV PATH $HOME/.cargo/bin:$PATH
15
- RUN cd /workspace/rust && cargo build && rm src/lib.rs
16
-
17
- USER root
10
+ RUN ln -s /home/codewarrior /workspace
18
11
ENV NPM_CONFIG_LOGLEVEL warn
19
12
20
13
WORKDIR /runner
@@ -33,9 +26,20 @@ COPY test/runners/rust_spec.js test/runners/
33
26
COPY entrypoint.sh entrypoint.sh
34
27
RUN chmod +x entrypoint.sh
35
28
29
+ COPY frameworks/rust/skeleton /workspace/rust
30
+ RUN chown -R codewarrior:codewarrior /workspace/rust
31
+
36
32
USER codewarrior
37
- ENV USER=codewarrior HOME=/home/codewarrior
38
- ENV PATH=$HOME/.cargo/bin:$PATH
33
+ ENV USER=codewarrior \
34
+ HOME=/home/codewarrior \
35
+ # set RUSTFLAGS (for backward compatibility) here
36
+ # compiling with different RUSTFLAGS for submitted solution causes downloaded crates to be recompiled
37
+ RUSTFLAGS='-Adead_code -Aunused_imports -Aunused_variables -Anon_snake_case'
38
+ # download and compile crates
39
+ RUN set -ex; \
40
+ cd /workspace/rust; \
41
+ cargo build; \
42
+ rm src/lib.rs
39
43
40
44
RUN mocha -t 10000 test/runners/rust_spec.js
41
45
0 commit comments