Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature : generation docker-compose by maven (manual from @dedece35) #9

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
7 changes: 6 additions & 1 deletion src/android-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>fr.cnumr</groupId>
<artifactId>ecocode</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<groupId>io.ecocode</groupId>
<artifactId>ecocode-rules</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>sonar-plugin</packaging>

<name>ecoCode Android plugin</name>
Expand Down
13 changes: 13 additions & 0 deletions src/android-plugin/src/main/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'

services:

sonar:
image: sonarqube:${sonar_version_server}
container_name: ecoCode-sonar
restart: unless-stopped
volumes:
- ${basedir}/target/ecocode-rules-${project.version}.jar:/opt/sonarqube/extensions/plugins/ecocode-rules-${project.version}.jar
ports:
- 9000:9000
- 9092:9092
53 changes: 41 additions & 12 deletions src/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.organization>cnumr-1</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<!-- resources-plugin injection -->
<sonar_version_server>9.3-community</sonar_version_server>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -180,17 +183,43 @@

</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>

</project>
<configuration>
<outputDirectory>${basedir}/target/extra-resources</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/scripts/</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
55 changes: 55 additions & 0 deletions src/src/main/scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.3"
services:
sonar:
image: sonarqube:${sonar_version_server}
ports:
- "9000:9000"
networks:
- sonarnet
depends_on:
- db
environment:
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonarqube
SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true'
volumes:
- type: bind
source: ${basedir}/java-plugin/target/ecocode-java-plugin-${project.version}.jar
target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-${project.version}.jar
- type: bind
source: ${basedir}/php-plugin/target/ecocode-php-plugin-${project.version}.jar
target: /opt/sonarqube/extensions/plugins/ecocode-php-plugin-${project.version}.jar
- type: bind
source: ${basedir}/python-plugin/target/ecocode-python-plugin-${project.version}.jar
target: /opt/sonarqube/extensions/plugins/ecocode-python-plugin-${project.version}.jar
- type: bind
source: ${basedir}/android-plugin/target/ecocode-rules-${project.version}.jar
target: /opt/sonarqube/extensions/plugins/ecocode-rules-${project.version}.jar
# - "conf:/opt/sonarqube/conf"
- "extensions:/opt/sonarqube/extensions"
- "logs:/opt/sonarqube/logs"
- "data:/opt/sonarqube/data"

db:
image: postgres:12
container_name: postgresql
networks:
- sonarnet
volumes:
- pg_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar
POSTGRES_DB: sonarqube
PGDATA: pg_data:/var/lib/postgresql/data/pgdata

networks:
sonarnet:
driver: bridge

volumes:
data:
logs:
extensions:
pg_data: