Skip to content

Commit

Permalink
feat: add rust
Browse files Browse the repository at this point in the history
  • Loading branch information
batleforc committed Jan 11, 2025
1 parent 59e0659 commit dea93be
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sonar-node/NW.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM sonarsource/sonar-scanner-cli:5

RUN apk add --no-cache \
ca-certificates \
gcc \
musl-dev \
openssl \
openssl-dev \
git \
libgit2

## Install nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh | bash
RUN echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ${HOME}/.bashrc
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ${HOME}/.bashrc && \
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> ${HOME}/.bashrc
RUN . ${HOME}/.bashrc && nvm install ${NODE_VERSION} && nvm alias default ${NODE_VERSION} && nvm use default && nvm cache clear && npm install --global yarn && corepack enable pnpm
ENV VSCODE_NODEJS_RUNTIME_DIR=/home/tooling/.nvm/versions/node/v${NODE_VERSION}/bin
ENV PATH=/home/tooling/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH
38 changes: 38 additions & 0 deletions sonar-rust/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM sonarsource/sonar-scanner-cli:5

RUN apk add --no-cache \
ca-certificates \
gcc \
musl-dev \
openssl \
openssl-dev \
git \
libgit2

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.84.0 \
OPENSSL_STATIC=true

RUN set -eux; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) rustArch='x86_64-unknown-linux-musl'; rustupSha256='7aa9e2a380a9958fc1fc426a3323209b2c86181c6816640979580f62ff7d48d4' ;; \
aarch64) rustArch='aarch64-unknown-linux-musl'; rustupSha256='b1962dfc18e1fd47d01341e6897cace67cddfabf547ef394e8883939bd6e002e' ;; \
*) echo >&2 "unsupported architecture: $apkArch"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
rustup component add clippy; \
cargo install cargo-audit; \
cargo install --locked cargo-outdated; \
cargo install cargo-sonar;

0 comments on commit dea93be

Please sign in to comment.