Official docker image for sonar scanner cli

I’ve read about some of the challenges surrounding an official SonarQube docker image; however, I think it would be extremely easy to create and maintain an official docker image for the sonar scanner cli that could be integrated into build pipelines and into services’ docker-compose files.

In fact there is an unofficial image that someone has put together here that functions the same way I’d imagine, but it would be far preferable to have an official image:

Would love this feature. Especially useful for CI pipelines.

2 Likes

We use the following Dockerfile within GitLab CI:

FROM node:lts-stretch

WORKDIR /code

RUN apt-get update -yqq && \
    apt-get install -yqq --no-install-recommends openjdk-8-jre-headless && \
    rm -rf /var/lib/apt/lists/*

RUN npm config set unsafe-perm true && \
    npm install -g sonarqube-scanner && \
    sonar-scanner --version

ENTRYPOINT ["sonar-scanner"]

Usage in GitLab:

sonarqube:
  image:
    name: ${CI_REGISTRY}/sonarqube-scanner:latest
    entrypoint: [""]
  allow_failure: true
  dependencies:
    - build
  only:
    - master
  except:
    variables:
      - $SKIP_SONARQUBE
  script:
    - git fetch --unshallow
    - sonar-scanner
      -D"sonar.log.level=${SONARQUBE_LOG_LEVEL:-INFO}"
      -D"sonar.verbose=${SONARQUBE_VERBOSE:-false}"
      -D"sonar.projectKey=${CI_PROJECT_PATH_SLUG}"
      -D"sonar.login=${SONARQUBE_TOKEN}"
      -D"sonar.projectVersion=${CI_COMMIT_SHORT_SHA}"
      -D"sonar.projectBaseDir=${CI_PROJECT_DIR}"

This seems official and do the trick:

Haven’t seen any announcement or anything, while I think this deserves some :partying_face:

1 Like

To be clear @len this image is BETA, as are the Developer Edition and Enterprise Edition images that were released with 8.0 (and announced along with it :wink:)

 
Ann

2 Likes

Good points, thanks :slight_smile: