From e3b41132561b23cdc11ba9cc751a17d5c9c48d61 Mon Sep 17 00:00:00 2001 From: Sawit Koseeyaumporn Date: Wed, 20 Nov 2024 11:50:10 +0700 Subject: [PATCH] fix: docker-compose.yml --- docker-compose.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 545470a..8b5e158 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ version: '3.7' services: - db: image: mysql:5.7 container_name: hackathon_db @@ -30,10 +29,62 @@ services: networks: - my_network + # SonarQube Database (PostgreSQL) + sonarqube_db: + image: postgres:13-alpine + container_name: sonarqube_db + environment: + POSTGRES_USER: sonar + POSTGRES_PASSWORD: sonar + POSTGRES_DB: sonarqube + volumes: + - sonarqube_db_data:/var/lib/postgresql/data + networks: + - my_network + + # SonarQube Service + sonarqube: + image: sonarqube:community + container_name: sonarqube + environment: + SONAR_JDBC_URL: jdbc:postgresql://sonarqube_db:5432/sonarqube + SONAR_JDBC_USERNAME: sonar + SONAR_JDBC_PASSWORD: sonar + ports: + - '9000:9000' # SonarQube UI + depends_on: + - sonarqube_db + networks: + - my_network + + # Prometheus Service + prometheus: + image: prom/prometheus + container_name: prometheus + ports: + - "9090:9090" # Prometheus UI + volumes: + - ./prometheus.yml:/etc/prometheus/prometheus.yml # Mount the Prometheus config + networks: + - my_network + + # Grafana Service + grafana: + image: grafana/grafana + container_name: grafana + ports: + - "3001:3000" # Expose Grafana on port 3001 + depends_on: + - prometheus + networks: + - my_network + networks: my_network: driver: bridge volumes: mysql_data: + driver: local + sonarqube_db_data: driver: local \ No newline at end of file