Skip to content

Instantly share code, notes, and snippets.

@freb97
Created November 19, 2021 16:13
Show Gist options
  • Save freb97/01867bb2003b57d8178d9b0c2e38125a to your computer and use it in GitHub Desktop.
Save freb97/01867bb2003b57d8178d9b0c2e38125a to your computer and use it in GitHub Desktop.
Install sonar-scanner-cli on Docker Alpine Linux
#!/bin/sh
# Set bash behaviour
set -eux
# Configure sonar version
SONAR_SCANNER_VERSION=4.6.2.2472
# Install dependencies
apk add --no-cache \
ca-certificates \
curl \
unzip \
libc6-compat \
openjdk8-jre
# Download sonar scanner
mkdir -p /opt
curl -fSL https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip \
-o /opt/sonar-scanner.zip
# Unzip file and remove zip
unzip -qq /opt/sonar-scanner.zip -d /opt
mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-linux /sonar-scanner
rm /opt/sonar-scanner.zip
# Set symlink
ln -s /sonar-scanner/bin/sonar-scanner /bin/sonar-scanner
# [WORKAROUND] Configure sonar-scanner to use system jre
sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /sonar-scanner/bin/sonar-scanner
@wilcorrea
Copy link

Thank you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment