From cd70230a30d39f722d3315c5737e0a63a37d5bef Mon Sep 17 00:00:00 2001 From: Michael Clarke Date: Sat, 16 Nov 2024 16:07:59 +0000 Subject: [PATCH] #958: Set plugin group ID to root in container build Not all the Sonarqube image variants contain a group named sonarqube, so the `chown` command fails as it's unable to find the target group. To overcome this the group is being set to `0` which should always exist as the root user's group. --- Dockerfile | 2 +- release.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6e0c84b6..f31490d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /home/build/project RUN gradle build -x test FROM sonarqube:${SONARQUBE_VERSION} -COPY --from=builder --chown=sonarqube /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/ +COPY --from=builder --chown=sonarqube:0 /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/ ARG PLUGIN_VERSION ENV PLUGIN_VERSION=${PLUGIN_VERSION} diff --git a/release.Dockerfile b/release.Dockerfile index 706aaeb2..8d62acec 100644 --- a/release.Dockerfile +++ b/release.Dockerfile @@ -5,7 +5,7 @@ FROM sonarqube:${SONARQUBE_VERSION} ARG PLUGIN_VERSION ENV PLUGIN_VERSION=${PLUGIN_VERSION} -ADD --chown=sonarqube https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/extensions/plugins/ +ADD --chown=sonarqube:0 https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/extensions/plugins/ ENV SONAR_WEB_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=web" ENV SONAR_CE_JAVAADDITIONALOPTS="-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar=ce"