diff --git a/Dockerfile b/Dockerfile index 5f1ce53..a2359df 100755 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk \ SONAR_USER_HOME=${SONAR_SCANNER_HOME}/.sonar \ PATH=${SONAR_SCANNER_HOME}/bin:${PATH} \ SRC_PATH=/usr/src \ + SCANNER_WORKDIR_PATH=/tmp/.scannerwork \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 @@ -32,10 +33,10 @@ RUN set -eux; \ rm sonar-scanner-cli.zip sonar-scanner-cli.zip.asc; \ mv sonar-scanner-${SONAR_SCANNER_VERSION} ${SONAR_SCANNER_HOME}; \ apk del --purge build-dependencies; \ - mkdir -p "${SRC_PATH}" "${SONAR_USER_HOME}" "${SONAR_USER_HOME}/cache"; \ - chown -R scanner-cli:scanner-cli "${SONAR_SCANNER_HOME}" "${SRC_PATH}"; \ + mkdir -p "${SRC_PATH}" "${SONAR_USER_HOME}" "${SONAR_USER_HOME}/cache" "${SCANNER_WORKDIR_PATH}"; \ + chown -R scanner-cli:scanner-cli "${SONAR_SCANNER_HOME}" "${SRC_PATH}" "${SCANNER_WORKDIR_PATH}"; \ chmod -R 555 "${SONAR_SCANNER_HOME}"; \ - chmod -R 754 "${SRC_PATH}" "${SONAR_USER_HOME}"; + chmod -R 754 "${SRC_PATH}" "${SONAR_USER_HOME}" "${SCANNER_WORKDIR_PATH}"; COPY --chown=scanner-cli:scanner-cli bin /usr/bin/ diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index b032f83..494f597 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -34,6 +34,7 @@ fi if [[ "$1" = 'sonar-scanner' ]]; then add_env_var_as_env_prop "${SONAR_TOKEN:-}" "sonar.token" add_env_var_as_env_prop "${SONAR_PROJECT_BASE_DIR:-}" "sonar.projectBaseDir" + add_env_var_as_env_prop "${SCANNER_WORKDIR_PATH:-}" "sonar.working.directory" if [[ ${#args[@]} -ne 0 ]]; then set -- sonar-scanner "${args[@]}" "${@:2}" fi