-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to generate Docker Image containing plugin
This change adds the relevant docker files to allow building a development docker image containing the code in this repository, or generating an image using a released version of the plugin, with either of these being backed by a particular base Docker image of Sonarqube's community releases. The `.env` file contains the variables required to configure what builds is performed with docker-compose.yml then driving the relevant creation from there.
- Loading branch information
Showing
6 changed files
with
77 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build/ | ||
/.idea/ | ||
/.gradle/ | ||
/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# The Sonarqube base image. 'latest' if building locally, '8.5-community' if targeting a specific version | ||
SONARQUBE_VERSION=latest | ||
|
||
# The name of the Dockerfile to run. 'Dockerfile' is building locally, 'release.Dockerfile' if building the release image | ||
DOCKERFILE=Dockerfile | ||
|
||
# The version of the plugin to include in the image; only relevant if 'release.Dockerfile' is being used | ||
PLUGIN_VERSION=1.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG SONARQUBE_VERSION | ||
|
||
FROM openjdk:11-jdk-slim as builder | ||
|
||
COPY . /home/build/project | ||
WORKDIR /home/build/project | ||
RUN ./gradlew build -x test | ||
|
||
FROM sonarqube:${SONARQUBE_VERSION} | ||
COPY --from=builder --chown=sonarqube:sonarqube /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/lib/common/ | ||
COPY --from=builder --chown=sonarqube:sonarqube /home/build/project/build/libs/sonarqube-community-branch-plugin-*.jar /opt/sonarqube/extensions/plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
version: "3.8" | ||
|
||
services: | ||
sonarqube: | ||
depends_on: | ||
- db | ||
image: mc1arke/sonarqube-with-community-branch-plugin:${SONARQUBE_VERSION} | ||
build: | ||
context: . | ||
dockerfile: ${DOCKERFILE} | ||
args: | ||
SONARQUBE_VERSION: ${SONARQUBE_VERSION} | ||
PLUGIN_VERSION: ${PLUGIN_VERSION} | ||
container_name: sonarqube | ||
ports: | ||
- 9000:9000 | ||
networks: | ||
- sonarnet | ||
environment: | ||
- SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar | ||
- SONARQUBE_JDBC_USERNAME=sonar | ||
- SONARQUBE_JDBC_PASSWORD=sonar | ||
volumes: | ||
- sonarqube_conf:/opt/sonarqube/conf | ||
- sonarqube_data:/opt/sonarqube/data | ||
db: | ||
image: postgres:11 | ||
container_name: postgres | ||
networks: | ||
- sonarnet | ||
environment: | ||
- POSTGRES_USER=sonar | ||
- POSTGRES_PASSWORD=sonar | ||
volumes: | ||
- postgresql:/var/lib/postgresql | ||
- postgresql_data:/var/lib/postgresql/data | ||
|
||
volumes: | ||
sonarqube_conf: | ||
sonarqube_data: | ||
postgresql: | ||
postgresql_data: | ||
|
||
networks: | ||
sonarnet: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ARG SONARQUBE_VERSION | ||
|
||
FROM sonarqube:${SONARQUBE_VERSION} | ||
|
||
ARG PLUGIN_VERSION | ||
ENV PLUGIN_VERSION=${PLUGIN_VERSION} | ||
|
||
ADD --chown=sonarqube:sonarqube https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/lib/common/ | ||
ADD --chown=sonarqube:sonarqube https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/${PLUGIN_VERSION}/sonarqube-community-branch-plugin-${PLUGIN_VERSION}.jar /opt/sonarqube/extensions/plugins/ |