In my company we are shifting from our local build machines to Docker Swarm. As such I am re-creating our build environment in a Dockerfile, where the image produced by it will be the Jenkins agent used for the job run.
As part of this I am also trying to install sonar-scanner. The relevant part is this:
RUN curl -s -L https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-126.96.36.1992-linux.zip -o sonarscanner.zip \ && unzip -qq sonarscanner.zip \ && rm -rf sonarscanner.zip \ && mv sonar-scanner-188.8.131.522-linux sonar-scanner COPY sonar-scanner.properties sonar-scanner/conf/sonar-scanner.properties ENV SONAR_RUNNER_HOME=sonar-scanner ENV PATH $PATH:sonar-scanner/bin
It seems to be installed properly because when testing it is found, however… it also returns an error:
docker run -it jenkins:test sh / # sonar-scanner sonar-scanner/bin/sonar-scanner: exec: line 66: /sonar-scanner/jre/bin/java: not found
But Java is present:
/ # java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (IcedTea 3.10.0) (Alpine 8.191.12-r0) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
/ # ls -l /usr/bin/java lrwxrwxrwx 1 root root 35 Feb 19 07:26 /usr/bin/java -> ../lib/jvm/default-jvm/jre/bin/java
What am I missing in my setup in order for sonar-scanner to work w/out the error above?