services: sonarqube: image: sonarqube:lts-community container_name: sonarqube ports: - "9001:9000" environment: - SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube-db:5432/sonar - SONARQUBE_JDBC_USERNAME=sonar - SONARQUBE_JDBC_PASSWORD=sonar - SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true volumes: - sonarqube_data:/opt/sonarqube/data - sonarqube_logs:/opt/sonarqube/logs - sonarqube_extensions:/opt/sonarqube/extensions networks: - sonarnet depends_on: - elasticsearch - sonarqube-db elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2 container_name: elasticsearch environment: - discovery.type=single-node - ES_JAVA_OPTS=-Xms512m -Xmx512m volumes: - elasticsearch_data:/usr/share/elasticsearch/data networks: - sonarnet sonarqube-db: image: postgres:16.3-alpine3.20 container_name: sonarqube-db environment: - POSTGRES_USER=sonar - POSTGRES_PASSWORD=sonar - POSTGRES_DB=sonar networks: - sonarnet volumes: - sonar_db:/var/lib/postgresql - sonar_db_data:/var/lib/postgresql/data sonarscanner: image: sonarsource/sonar-scanner-cli container_name: sonarscanner depends_on: - sonarqube volumes: - .:/usr/src working_dir: /usr/src networks: - sonarnet entrypoint: ["sonar-scanner"] networks: sonarnet: driver: bridge volumes: sonarqube_data: sonarqube_logs: sonarqube_extensions: elasticsearch_data: sonar_db: sonar_db_data: