Last active
May 28, 2024 00:01
-
-
Save ThabetAmer/b818a262c71467c7403fd75bc526b8f9 to your computer and use it in GitHub Desktop.
Run SonarQube and SonarScanner in Docker-compose
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
# | |
# Based on https://hub.docker.com/_/sonarqube | |
# | |
version: "3.7" | |
services: | |
sonarqube: | |
container_name: sonarqube | |
image: sonarqube:7.9.2-community | |
ports: | |
- "9000:9000" | |
environment: | |
- SONARQUBE_JDBC_URL=jdbc:postgresql://db:5432/sonar | |
- SONARQUBE_JDBC_USERNAME=sonar | |
- SONARQUBE_JDBC_PASSWORD=sonar | |
networks: | |
- sonarnet | |
volumes: | |
- sonarqube_conf:/opt/sonarqube/conf | |
- sonarqube_data:/opt/sonarqube/data | |
- sonarqube_logs:/opt/sonarqube/logs | |
- sonarqube_extensions:/opt/sonarqube/extensions | |
- sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins | |
db: | |
container_name: sonardb | |
image: postgres | |
networks: | |
- sonarnet | |
environment: | |
- POSTGRES_USER=sonar | |
- POSTGRES_PASSWORD=sonar | |
volumes: | |
- postgresql:/var/lib/postgresql | |
- postgresql_data:/var/lib/postgresql/data | |
sonarscanner: | |
container_name: sonarscanner | |
image: newtmitch/sonar-scanner | |
networks: | |
- sonarnet | |
volumes: | |
- ./:/usr/src | |
networks: | |
sonarnet: | |
volumes: | |
sonarqube_conf: | |
sonarqube_data: | |
sonarqube_logs: | |
sonarqube_extensions: | |
sonarqube_bundled-plugins: | |
postgresql: | |
postgresql_data: |
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
sonar-project.properties | |
# must be unique in a given SonarQube instance | |
sonar.projectKey=sample1 | |
# --- optional properties --- | |
# defaults to project key | |
#sonar.projectName=My project | |
# defaults to 'not provided' | |
#sonar.projectVersion=1.0 | |
# Path is relative to the sonar-project.properties file. Defaults to . | |
sonar.sources=. | |
# Encoding of the source code. Default is default system encoding | |
sonar.sourceEncoding=UTF-8 |
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
#!/bin/bash | |
# per https://hub.docker.com/_/sonarqube | |
# to be executed before launching the app | |
sysctl -w vm.max_map_count=262144 | |
sysctl -w fs.file-max=65536 | |
ulimit -n 65536 | |
ulimit -u 4096 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I borrowed some of your settings
Is it possible to add this docker-compose file in a dev container and access sonar scanner from the remote container in vscode ?
I tried some like this:
and in my .devcontainer file:
When I "Reopen In container" on my vscode I'd like to execute something like this:
but inside devcontainer I can't view the sonar scanner images