Skip to content

Commit

Permalink
SCANDOCKER-35 Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
csaba-feher-sonarsource committed Jul 19, 2024
1 parent ea52135 commit 724a164
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,32 @@ ARG SONAR_SCANNER_HOME=/opt/sonar-scanner
ARG SONAR_SCANNER_VERSION=5.0.1.3006
ENV HOME=/tmp \
XDG_CONFIG_HOME=/tmp \
SONAR_SCANNER_HOME=${SONAR_SCANNER_HOME}
SONAR_SCANNER_HOME=${SONAR_SCANNER_HOME} \
SCANNER_BINARIES=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli \
SCANNER_ZIP=sonar-scanner.zip \
SCANNER_ZIP_URL="${SCANNER_BINARIES}/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip"

WORKDIR /opt

# Security updates
RUN dnf upgrade -y --releasever=latest --security

# Only for extracting software
RUN dnf install -y unzip

# Install gnugp2 to perform signature validation
RUN dnf install -y --allowerasing gnupg2

RUN gpg --batch --keyserver "hkps://keys.openpgp.org" --recv-keys "679F1EE92B19609DE816FDE81DB198F93525EC1A"

RUN dnf install -y unzip; \
dnf install -y --allowerasing gnupg2; \
dnf clean all

ENV SCANNER_BINARIES=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
ENV SCANNER_ZIP=sonar-scanner.zip
ENV SCANNER_ZIP_URL="${SCANNER_BINARIES}/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip"
# Curl scanner binary
RUN curl --retry 12 --retry-all-errors ${SCANNER_ZIP_URL} -o ${SCANNER_ZIP} \
&& curl --retry 12 --retry-all-errors ${SCANNER_ZIP_URL}.asc -o ${SCANNER_ZIP}.asc
RUN curl --retry 12 --retry-all-errors ${SCANNER_ZIP_URL} -o ${SCANNER_ZIP}; \
curl --retry 12 --retry-all-errors ${SCANNER_ZIP_URL}.asc -o ${SCANNER_ZIP}.asc

RUN gpg --verify ${SCANNER_ZIP}.asc
RUN unzip ${SCANNER_ZIP} \
&& mv sonar-scanner-${SONAR_SCANNER_VERSION} ${SONAR_SCANNER_HOME} \
&& rm ${SCANNER_ZIP}
RUN gpg --batch --keyserver "hkps://keys.openpgp.org" --recv-keys "679F1EE92B19609DE816FDE81DB198F93525EC1A"; \
gpg --verify ${SCANNER_ZIP}.asc

RUN unzip ${SCANNER_ZIP}; \
mv sonar-scanner-${SONAR_SCANNER_VERSION} ${SONAR_SCANNER_HOME}; \
rm ${SCANNER_ZIP}


FROM amazoncorretto:17.0.12-al2023-headless AS scanner-cli-base
Expand All @@ -47,15 +46,13 @@ ENV HOME=/tmp \
SRC_PATH=/usr/src \
SCANNER_WORKDIR_PATH=/tmp/.scannerwork


# Copy Scanner installation from builder image
COPY --from=builder /opt/sonar-scanner /opt/sonar-scanner

RUN dnf install -y git

RUN dnf install -y nodejs

RUN dnf install -y shadow-utils
RUN dnf install -y git; \
dnf install -y nodejs; \
dnf install -y shadow-utils; \
dnf clean all

RUN set -eux; \
groupadd --system --gid 900 scanner-cli; \
Expand Down

0 comments on commit 724a164

Please sign in to comment.