-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (35 loc) · 1.53 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM noenv/openjdk:23.0.1
LABEL maintainer "NoEnv"
LABEL version "6.2.1"
LABEL description "SonarQube Scanner as Docker Image"
ENV SONAR_SCANNER_VERSION 6.2.1.4610
ENV NODE_VERSION 23.1.0
ENV JAVA_HOME /docker-java-home
RUN apt-get update && \
apt-get install -y unzip curl && \
curl -fsSLo /tmp/sonar-scanner-cli.zip "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip" && \
unzip -q /tmp/sonar-scanner-cli.zip && \
ARCH="$(dpkg --print-architecture)" && \
case "${ARCH}" in \
aarch64|arm64) \
NODE_BINARY_URL="https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-arm64.tar.gz"; \
;; \
amd64|i386:x86-64) \
NODE_BINARY_URL="https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz"; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
curl -fsSLo /tmp/node-linux.tar.gz ${NODE_BINARY_URL} && \
tar -xf /tmp/node-linux.tar.gz -C /usr/local --strip-components=1 --no-same-owner && \
mkdir -p /data /drone/volume && \
ln -s /sonar-scanner-${SONAR_SCANNER_VERSION} /sonar-scanner && \
mv -f /sonar-scanner/conf/sonar-scanner.properties /drone/volume/ && \
ln -s /drone/volume/sonar-scanner.properties /sonar-scanner/conf/ && \
ln -s /docker-java-home/bin/java /usr/local/bin/ && \
ln -s /sonar-scanner/bin/sonar-scanner /usr/local/bin/ && \
rm -rf rm -rf /var/lib/apt/lists/* /tmp/sonar-scanner-cli.zip /tmp/node-linux.tar.xz
WORKDIR /data
CMD ["sonar-scanner"]