From 14d1cd8c48a05898c98107c8d3a100ef5447b7e5 Mon Sep 17 00:00:00 2001 From: kazk Date: Fri, 14 Jul 2017 18:53:42 -0700 Subject: [PATCH 1/3] Set Rust version to 1.15.1 --- docker/rust.docker | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/docker/rust.docker b/docker/rust.docker index 850ee9dd..517ab8dc 100644 --- a/docker/rust.docker +++ b/docker/rust.docker @@ -1,28 +1,38 @@ FROM codewars/base-runner -# Install Rust Compiler -RUN curl -sSf https://static.rust-lang.org/rustup.sh | sh +# Install Rust v1.15.1 to /usr/local +RUN set -ex \ + && cd /tmp \ + && curl -fSsL https://static.rust-lang.org/dist/2017-02-08/rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz -o rust.tar.gz \ + && echo "0c9318044a6adffda349a1aa82079f031f1fe500578a5eebba5bfd49c54a8f84 *rust.tar.gz" | sha256sum -c - \ + && mkdir -p /tmp/rust \ + && tar xzf rust.tar.gz -C /tmp/rust --strip-components=1 \ + && rm rust.tar.gz \ + && cd /tmp/rust \ + && ./install.sh \ + && rm -rf /tmp/rust # Setup env ENV USER codewarrior ENV HOME /home/codewarrior +ENV NPM_CONFIG_LOGLEVEL warn # Copy package json to tmp ADD package.json /tmp/package.json -# Do npm install in tmp and setup cargo dir -RUN \ - cd /tmp && npm install --production && \ - mkdir -p /runner && cp -a /tmp/node_modules /runner +# Do npm install in tmp +RUN cd /tmp \ + && npm install --production \ + && mkdir -p /runner \ + && cp -a /tmp/node_modules /runner \ + && rm -rf /tmp/node_modules /tmp/package.json # ADD cli-runner ADD . /runner -# Working dir is /runner WORKDIR /runner RUN ln -s /home/codewarrior /workspace -# Codewarrior... USER codewarrior RUN mocha -t 10000 test/runners/rust_spec.js From cd37e829f6ab654ee6637c5eac65ff8f76624992 Mon Sep 17 00:00:00 2001 From: Hugo Armstrong Date: Sat, 15 Jul 2017 09:26:08 +0000 Subject: [PATCH 2/3] Use rustup for better versioning --- docker/rust.docker | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/docker/rust.docker b/docker/rust.docker index 517ab8dc..bc6b3681 100644 --- a/docker/rust.docker +++ b/docker/rust.docker @@ -1,21 +1,14 @@ FROM codewars/base-runner -# Install Rust v1.15.1 to /usr/local -RUN set -ex \ - && cd /tmp \ - && curl -fSsL https://static.rust-lang.org/dist/2017-02-08/rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz -o rust.tar.gz \ - && echo "0c9318044a6adffda349a1aa82079f031f1fe500578a5eebba5bfd49c54a8f84 *rust.tar.gz" | sha256sum -c - \ - && mkdir -p /tmp/rust \ - && tar xzf rust.tar.gz -C /tmp/rust --strip-components=1 \ - && rm rust.tar.gz \ - && cd /tmp/rust \ - && ./install.sh \ - && rm -rf /tmp/rust - # Setup env ENV USER codewarrior ENV HOME /home/codewarrior ENV NPM_CONFIG_LOGLEVEL warn +ENV PATH $HOME/.cargo/bin:$PATH + +# Install rustup with the Rust v1.15.1 toolchain +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.15.1 \ + && echo 'source $HOME/.cargo/env' >> $HOME/.bashrc # Copy package json to tmp ADD package.json /tmp/package.json From 4210022c60efe3e5d2b2bd1359b4bb16f01a5794 Mon Sep 17 00:00:00 2001 From: kazk Date: Sat, 15 Jul 2017 12:05:00 -0700 Subject: [PATCH 3/3] Avoid a warning during rustup installation warning: $HOME differs from euid-obtained home directory: you may be using sudo --- docker/rust.docker | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/rust.docker b/docker/rust.docker index bc6b3681..c9546c01 100644 --- a/docker/rust.docker +++ b/docker/rust.docker @@ -1,15 +1,14 @@ FROM codewars/base-runner # Setup env -ENV USER codewarrior -ENV HOME /home/codewarrior -ENV NPM_CONFIG_LOGLEVEL warn -ENV PATH $HOME/.cargo/bin:$PATH +USER codewarrior +ENV USER=codewarrior HOME=/home/codewarrior # Install rustup with the Rust v1.15.1 toolchain -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.15.1 \ - && echo 'source $HOME/.cargo/env' >> $HOME/.bashrc +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.15.1 +USER root +ENV NPM_CONFIG_LOGLEVEL warn # Copy package json to tmp ADD package.json /tmp/package.json @@ -27,6 +26,9 @@ WORKDIR /runner RUN ln -s /home/codewarrior /workspace USER codewarrior +ENV USER=codewarrior HOME=/home/codewarrior +# ~/.cargo/env +ENV PATH $HOME/.cargo/bin:$PATH RUN mocha -t 10000 test/runners/rust_spec.js