2019-05-29 20:58:46 +00:00
|
|
|
FROM rust
|
|
|
|
|
2019-06-10 14:56:17 +00:00
|
|
|
# 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 17:34:46 +00:00
|
|
|
# Install Node.js
|
|
|
|
ENV NODE_VERSION 12.0.0
|
2019-06-10 14:56:17 +00:00
|
|
|
ENV NVM_DIR /home/nonroot/.nvm
|
|
|
|
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
2019-05-29 20:58:46 +00:00
|
|
|
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
|
2019-04-28 17:34:46 +00:00
|
|
|
# Check that Node.js was correctly installed
|
2019-05-12 03:58:45 +00:00
|
|
|
RUN node --version
|
|
|
|
|
|
|
|
# Install Go
|
2019-09-04 23:13:53 +00:00
|
|
|
ENV GO_VERSION 1.12.1
|
2019-06-10 14:56:17 +00:00
|
|
|
ENV GOENV_ROOT /home/nonroot/.goenv
|
2019-05-12 03:58:45 +00:00
|
|
|
ENV PATH $GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH
|
2019-05-29 20:58:46 +00:00
|
|
|
RUN git clone https://github.com/syndbg/goenv.git $GOENV_ROOT \
|
2019-06-10 14:56:17 +00:00
|
|
|
&& eval "$(goenv init -)" \
|
|
|
|
&& goenv install $GO_VERSION \
|
|
|
|
&& goenv global $GO_VERSION \
|
|
|
|
&& chmod -R a+x $GOENV_ROOT
|
2019-05-12 03:58:45 +00:00
|
|
|
# Check that Go was correctly installed
|
|
|
|
RUN go version
|
2019-05-29 20:58:46 +00:00
|
|
|
|
2019-08-13 22:43:29 +00:00
|
|
|
# Install Ruby
|
2019-09-04 23:13:53 +00:00
|
|
|
ENV RUBY_VERSION 2.6.3
|
2019-08-13 22:43:29 +00:00
|
|
|
ENV RBENV_ROOT /home/nonroot/.rbenv
|
|
|
|
ENV PATH $RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH
|
|
|
|
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash \
|
|
|
|
&& rbenv install $RUBY_VERSION \
|
|
|
|
&& rbenv global $RUBY_VERSION
|
|
|
|
# Check that Ruby was correctly installed
|
|
|
|
RUN ruby --version
|
|
|
|
|
2019-05-14 03:53:26 +00:00
|
|
|
# Install Python
|
2019-07-19 19:56:36 +00:00
|
|
|
ENV PYTHON_VERSION 3.6.9
|
2019-06-10 14:56:17 +00:00
|
|
|
ENV PYENV_ROOT /home/nonroot/.pyenv
|
2019-05-29 20:58:46 +00:00
|
|
|
ENV PATH $PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH
|
2019-05-14 03:53:26 +00:00
|
|
|
RUN curl https://pyenv.run | bash \
|
|
|
|
&& pyenv install $PYTHON_VERSION \
|
2019-06-10 14:56:17 +00:00
|
|
|
&& pyenv global $PYTHON_VERSION \
|
|
|
|
&& chmod -R a+x $PYENV_ROOT
|
2019-05-14 03:53:26 +00:00
|
|
|
# Check that Python was correctly installed
|
|
|
|
RUN python --version
|
2019-04-28 17:34:46 +00:00
|
|
|
|
|
|
|
# Create blank project
|
2019-06-10 14:56:17 +00:00
|
|
|
RUN USER=nonroot cargo new --bin /src/starship
|
|
|
|
WORKDIR /src/starship
|
2019-04-28 17:34:46 +00:00
|
|
|
|
2019-09-30 12:10:35 +00:00
|
|
|
# Copy the whole project
|
|
|
|
COPY . .
|
2019-04-28 17:34:46 +00:00
|
|
|
|
2019-06-10 14:56:17 +00:00
|
|
|
# "-Z unstable-options" is required for "--include-ignored"
|
|
|
|
CMD ["cargo", "test", "--", "-Z", "unstable-options", "--include-ignored"]
|