Created
November 19, 2021 16:13
-
-
Save freb97/01867bb2003b57d8178d9b0c2e38125a to your computer and use it in GitHub Desktop.
Install sonar-scanner-cli on Docker Alpine Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you <3