starship/tests/Dockerfile

59 lines
1.6 KiB
Docker
Raw Normal View History

FROM rust
# Create /src as root
RUN mkdir /src && chmod -R a+w /src
# Create non-root user
RUN useradd -ms /bin/bash nonroot
USER nonroot
2019-04-28 19:34:46 +02:00
# Install Node.js
ENV NODE_VERSION 12.0.0
ENV NVM_DIR /home/nonroot/.nvm
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
2019-04-28 19:34:46 +02:00
# Check that Node.js was correctly installed
2019-05-12 05:58:45 +02:00
RUN node --version
# Install Go
ENV GO_VERSION 1.10.0
ENV GOENV_ROOT /home/nonroot/.goenv
2019-05-12 05:58:45 +02:00
ENV PATH $GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH
RUN git clone https://github.com/syndbg/goenv.git $GOENV_ROOT \
&& eval "$(goenv init -)" \
&& goenv install $GO_VERSION \
&& goenv global $GO_VERSION \
&& chmod -R a+x $GOENV_ROOT
2019-05-12 05:58:45 +02:00
# Check that Go was correctly installed
RUN go version
# Install Python
2019-07-19 21:56:36 +02:00
ENV PYTHON_VERSION 3.6.9
ENV PYENV_ROOT /home/nonroot/.pyenv
ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH
RUN curl https://pyenv.run | bash \
&& pyenv install $PYTHON_VERSION \
&& pyenv global $PYTHON_VERSION \
&& chmod -R a+x $PYENV_ROOT
# Check that Python was correctly installed
RUN python --version
2019-04-28 19:34:46 +02:00
# Create blank project
RUN USER=nonroot cargo new --bin /src/starship
WORKDIR /src/starship
2019-04-28 19:34:46 +02:00
# We want dependencies cached, so copy those first
2019-05-12 05:58:45 +02:00
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
2019-04-28 19:34:46 +02:00
# Cargo.toml will fail to parse without my_benchmark
RUN mkdir benches
RUN touch benches/my_benchmark.rs
# This is a dummy build to get dependencies cached
RUN cargo build --release \
&& rm -rf src target/debug/starship*
2019-04-28 19:34:46 +02:00
# "-Z unstable-options" is required for "--include-ignored"
CMD ["cargo", "test", "--", "-Z", "unstable-options", "--include-ignored"]